Skip to content

Commit 35c3f7a

Browse files
fix useEffect dependencies
1 parent c8a1960 commit 35c3f7a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/hooks/useComputed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function useComputed(subtree: string, computeCallback: ComputeCallback) {
1616
});
1717

1818
return dispose;
19-
}, []);
19+
}, [subtree, computeCallback]);
2020

2121
console.log('computed value through hook', computedValue);
2222

src/hooks/useDoc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function useSyncState(
1919
const dispose = store.observe(subtree, path, () => forceUpdate(), depth);
2020

2121
return dispose;
22-
}, []);
22+
}, [subtree, path, depth]);
2323
// console.log(path, doc.getStateAtPath(path), 'doc.getStateAtPath(path)');
2424

2525
return store.useSyncState(subtree, path);

0 commit comments

Comments
 (0)