Skip to content

Commit

Permalink
fix: simplify defaultSWRParams
Browse files Browse the repository at this point in the history
  • Loading branch information
cicerchia committed Aug 22, 2021
1 parent 998db3f commit b02eb7b
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/lib/swr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ const defaultSWRStore = {
};

const defaultSWRParams = {
options: {
enabled: true,
initialData: undefined,
// revalidateOnFocus: true,
// revalidateOnReconnect: true,
},
enabled: true,
initialData: undefined,
// revalidateOnFocus: true,
// revalidateOnReconnect: true,
};

export function useSWR<T>(): SWRStore<T> {
Expand All @@ -64,14 +62,8 @@ export function useSWR<T>(): SWRStore<T> {
});

function update(params: SWRParams<T>) {
params = {
...defaultSWRParams,
...params,
options: {
...defaultSWRParams.options,
...params.options,
},
};
params.options = { ...defaultSWRParams, ...params.options };

fsm.send("revalidate", params);
}

Expand Down

0 comments on commit b02eb7b

Please sign in to comment.