Skip to content

Commit

Permalink
fix: re-run client hooks on parameter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Dec 3, 2021
1 parent aa14cbd commit 1fd3dad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/useStatefulPrismicClientMethod.ts
Expand Up @@ -157,7 +157,7 @@ export const useStatefulPrismicClientMethod = <

React.useEffect(
() => {
if (state.state === "idle" && !skip) {
if (!skip) {
dispatch(["start"]);

client[methodName]
Expand All @@ -175,11 +175,10 @@ export const useStatefulPrismicClientMethod = <
// eslint-disable-next-line react-hooks/exhaustive-deps
[
client,
state.state,
skip,
methodName,
// eslint-disable-next-line react-hooks/exhaustive-deps
...args.slice(0, -1),
...argsWithoutParams,
// eslint-disable-next-line react-hooks/exhaustive-deps
...getParamHookDependencies(params),
],
Expand Down

0 comments on commit 1fd3dad

Please sign in to comment.