Skip to content

Commit

Permalink
update localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
sdankel committed Dec 14, 2024
1 parent e99c810 commit 5ab77db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/AbiApp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import LogView from "./features/editor/components/LogView";
import { loadAbi, saveSwayCode } from "./utils/localStorage";
import { loadAbi, saveAbi, saveSwayCode } from "./utils/localStorage";
import InteractionDrawer from "./features/interact/components/InteractionDrawer";
import { useLog } from "./features/editor/hooks/useLog";
import { Analytics } from "@vercel/analytics/react";
Expand All @@ -26,6 +26,11 @@ function AbiApp() {
// The theme color for the app.
const { themeColor } = useTheme();

// Update the ABI in localstorage when the editor changes.
useEffect(() => {
saveAbi(abiCode);
}, [abiCode]);

const onSwayCodeChange = useCallback(
(code: string) => {
saveSwayCode(code);
Expand Down

0 comments on commit 5ab77db

Please sign in to comment.