Skip to content

Conversation

harry-gocity
Copy link

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

const cacheData = await cacheHandler.get(key, {
revalidate,
tags: allTags,
kind: "FETCH" as unknown as any,
Copy link
Author

@harry-gocity harry-gocity Aug 27, 2025

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

Copy link
Collaborator

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,
Copy link
Author

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.

Copy link
Collaborator

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.

@AyronK AyronK changed the base branch from master to canary August 28, 2025 14:24
@AyronK AyronK self-requested a review August 28, 2025 14:24
@harry-gocity
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants