-
Notifications
You must be signed in to change notification settings - Fork 6
Support for neshClassicCache
#73
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: canary
Are you sure you want to change the base?
Conversation
const cacheData = await cacheHandler.get(key, { | ||
revalidate, | ||
tags: allTags, | ||
kind: "FETCH" as unknown as any, |
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 don't love this casting, but importing CachedRouteKind
from next/dist
raises
TS2748: Cannot access ambient const enums when
isolatedModules
is enabled.
This also was kindHint: "fetch"
. But that seems incompatible with the CacheHandler
typings. I haven't been able to find any reference to what kindHint
actually does.
https://github.com/search?q=repo%3Acaching-tools%2Fnext-shared-cache%20kindHint
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.
Yes I am familiar with this issue of casting and importing enum from next/dist. I think we need to just accept it as it is. Perhaps not to any
, but I will take a look more closely later this week or on Monday.
cacheHandler.set( | ||
key, | ||
{ | ||
kind: "FETCH" as CachedRouteKind.FETCH, |
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.
Similar thoughts here re casting.
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 know that pain, unfortunately I did not find a nice way of solving it.
I'd like to test this with a snapshot release of sorts @AyronK (sorry, I had intended to raise this as a draft). Do you have a mechanism to publish such releases to NPM? |
Copies over source from https://github.com/caching-tools/next-shared-cache/blob/%40neshca/cache-handler%401.9.0/packages/cache-handler/src/functions/nesh-classic-cache.ts, with updated imports for
workAsyncStorage
. See commit by commit for deviation.#43