Skip to content

Commit 586ec9b

Browse files
committed
fix: cache is missing on server side
1 parent a553657 commit 586ec9b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/utils/cache.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ export function initCache<Data = any>(
4141
Data
4242
>
4343

44+
// Update the state if it's new, or the provider has been extended.
45+
SWRGlobalState.set(provider, [
46+
EVENT_REVALIDATORS,
47+
{},
48+
{},
49+
{},
50+
{},
51+
{},
52+
mutate
53+
])
54+
4455
// This is a new provider, we need to initialize it and setup DOM events
4556
// listeners for `focus` and `reconnect` actions.
4657
if (!IS_SERVER) {
47-
// Update the state if it's new, or the provider has been extended.
48-
SWRGlobalState.set(provider, [
49-
EVENT_REVALIDATORS,
50-
{},
51-
{},
52-
{},
53-
{},
54-
{},
55-
mutate
56-
])
57-
5858
opts.initFocus(
5959
revalidateAllKeys.bind(
6060
UNDEFINED,

0 commit comments

Comments
 (0)