Skip to content

Commit

Permalink
fix: re-run hook on argument changes
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Dec 3, 2021
1 parent 2c91305 commit 4b2da91
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/useStatefulPrismicClientMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,15 @@ export const useStatefulPrismicClientMethod = <
// JSON.stringify on params (effectively a deep equality check).
// We want this effect to run again anytime params change.
// eslint-disable-next-line react-hooks/exhaustive-deps
[client, methodName, skip, JSON.stringify(params)],
[
client,
methodName,
skip,
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(argsWithoutParams),
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(params),
],
);

return React.useMemo(
Expand Down

0 comments on commit 4b2da91

Please sign in to comment.