-
Notifications
You must be signed in to change notification settings - Fork 91
fix: support revalidateTag SWR in 'use cache' handler #3180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📊 Package size report 0.06%↑
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
8e49bbe
to
dd90408
Compare
@@ -1,4 +1,4 @@ | |||
import { unstable_cacheLife as cacheLife, unstable_cacheTag as cacheTag } from 'next/cache' | |||
import { cacheLife, cacheTag } from '../../../../../next-cache' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and other changes like that are not directly related to SWR revalidateTag. Instead it is because cacheLife
is no longer exported as unstable_cacheLife
- see vercel/next.js#84877 and this is just adjustment to make this fixture before/after this change
export const cacheLife: any = | ||
'cacheLife' in NextCache | ||
? NextCache.cacheLife | ||
: 'unstable_cacheLife' in NextCache | ||
? NextCache.unstable_cacheLife | ||
: () => { | ||
throw new Error('both unstable_cacheLife and cacheLife are missing from next/cache') | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was changed in vercel/next.js#84877
The cacheTag
handling is just future proofing (it's still unstable_cacheTag
as of now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cacheTag
was also updated now (in vercel/next.js#84880 )
env: { | ||
NX_ISOLATE_PLUGINS: 'false', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure here, but without it we were hitting error described in nrwl/nx#27040 and this was suggested workaround and seems to work. While the issue was closed with a fix, it seems like it doesn't handle whatever happens in next@canary
now
215fd25
to
5dfc14e
Compare
5dfc14e
to
8707d32
Compare
8707d32
to
981a652
Compare
Description
Support
revalidateTag
SWR profiles foruse cache
handler. This is follow up to #3173 which added support for regular cache handler