Ver código fonte

refacto rcontext swr

Yuken Tezuka 3 anos atrás
pai
commit
6462da8b87
1 arquivos alterados com 3 adições e 4 exclusões
  1. 3 4
      packages/app/src/stores/use-context-swr.tsx

+ 3 - 4
packages/app/src/stores/use-context-swr.tsx

@@ -18,8 +18,7 @@ export function useContextSWR<Data, Error>(
 
   const swrResponse = useStaticSWR<Data, Error>(key, data, configuration);
 
-  return {
-    ...swrResponse,
-    mutate: () => { throw Error('mutate can not be used in context') },
-  };
+  const result = Object.assign(swrResponse, { mutate: () => { throw Error('mutate can not be used in context') } });
+
+  return result;
 }