Skip to content

Commit

Permalink
Whoops removing def from deps again, like it was before 0.4.0 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodman authored Nov 13, 2023
1 parent 8cc7852 commit 9f943dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "replicache-react",
"version": "4.0.0",
"version": "4.0.1",
"description": "Miscellaneous utilities for using Replicache with React",
"homepage": "https://replicache.dev",
"repository": "github:rocicorp/replicache-react",
Expand Down
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ export function useSubscribe<Tx, Data, QueryRet extends Data, Default>(
unsubscribe();
setSnapshot(undefined);
};
}, [r, def, ...deps]);
// NOTE: `def` and `query` not passed as a dep here purposely. It would be
// more correct to pass them, but it's also a footgun since it's common to
// pass object, array, or function literals which change on every render.
// Also note that if this ever changes, it's a breaking change and should
// be documented, as if callers pass an object/array/func literal, changing
// this will cause a render loop that would be hard to debug.
}, [r, ...deps]);
if (snapshot === undefined) {
return def;
}
Expand Down

0 comments on commit 9f943dd

Please sign in to comment.