Skip to content
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

feat: d1 adapter for the tag cache #320

Merged
merged 28 commits into from
Feb 25, 2025
Merged

feat: d1 adapter for the tag cache #320

merged 28 commits into from
Feb 25, 2025

Conversation

james-elicx
Copy link
Collaborator

@james-elicx james-elicx commented Feb 2, 2025

  • Enable tag/path revalidation and next/after e2es for app directory example.
  • Enable passing a function for the tag cache.
  • D1 adapter for the tag cache, based on the AWS DynamoDB adapter.
  • Extracts a manifest of build-time tags/paths and creates an sql file that can be used to stub D1.
  • Adds the env.d.ts file to the tsconfig so that TypeScript recognises env vars defined in there.
  • Bumps aws to return meta files from createAssets() opennextjs-aws#748

Docs PR - opennextjs/docs#66

Copy link

changeset-bot bot commented Feb 2, 2025

🦋 Changeset detected

Latest commit: f5d8133

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Feb 2, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@320

commit: f5d8133

@james-elicx james-elicx linked an issue Feb 2, 2025 that may be closed by this pull request
@james-elicx james-elicx marked this pull request as ready for review February 2, 2025 22:44
@james-elicx james-elicx mentioned this pull request Feb 2, 2025
@james-elicx james-elicx force-pushed the james/tag-cache branch 3 times, most recently from 401843a to 69f2d20 Compare February 5, 2025 22:11
@james-elicx james-elicx force-pushed the james/isr branch 2 times, most recently from 229b2e2 to fa3b420 Compare February 6, 2025 22:08
Base automatically changed from james/isr to main February 7, 2025 11:30
@james-elicx james-elicx force-pushed the james/tag-cache branch 2 times, most recently from 79bab94 to 54a89cb Compare February 10, 2025 07:51
Copy link
Collaborator

@conico974 conico974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work!!
To be perfectly honest, i'm still not 100% convinced that D1 is the perfect fit for this (at least not alone). The tag cache can be used in SSR for the fetch cache and i'm not sure if D1 can handle heavy workload for these cases.
It's probably fine in most cases but i still wanted to point this out

@james-elicx james-elicx requested review from vicb and removed request for vicb February 20, 2025 17:54
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple comments.

IIUC we should first get opennextjs/opennextjs-aws#717 merged and then this PR?

Even if using D1 is not ideal, we can keep iterating before 1.0 but it would be nice to unblock people as early as we can.

WDYT @conico974 @james-elicx ?

@conico974
Copy link
Collaborator

IIUC we should first get opennextjs/opennextjs-aws#717 merged and then this PR?

Not necessarily, but it would avoid people getting a bunch of errors if they use this with page router only. And it avoids checking the cache tag for page router.

Even if using D1 is not ideal, we can keep iterating before 1.0 but it would be nice to unblock people as early as we can.

I agree, and it will allow to collect some feedback

@vicb
Copy link
Contributor

vicb commented Feb 21, 2025

@conico974

opennextjs/opennextjs-aws#717

What's missing for this PR to get merged? Do you have an approximate ETA in mind?

@conico974
Copy link
Collaborator

@vicb it should be ready actually, i just requested a review

@james-elicx
Copy link
Collaborator Author

IIUC we should first get opennextjs/opennextjs-aws#717 merged and then this PR?

I thought we had agreed that we would add both modes with users having the option of deciding which they want to use, so there shouldn't be any dependency on the new mode for this PR. Unless we want to add the other mode in this PR as well and release both modes at the same time?

@james-elicx james-elicx requested a review from vicb February 25, 2025 07:34
@vicb
Copy link
Contributor

vicb commented Feb 25, 2025

IIUC we should first get opennextjs/opennextjs-aws#717 merged and then this PR?

I thought we had agreed that we would add both modes with users having the option of deciding which they want to use, so there shouldn't be any dependency on the new mode for this PR. Unless we want to add the other mode in this PR as well and release both modes at the same time?

I was referring to "Not necessarily, but it would avoid people getting a bunch of errors if they use this with page router only. And it avoids checking the cache tag for page router."

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for creating this PR and all of the updates!μ

LGTM, a couple minor comments.

🚀

@james-elicx james-elicx merged commit ff2dd55 into main Feb 25, 2025
7 checks passed
@james-elicx james-elicx deleted the james/tag-cache branch February 25, 2025 08:40
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.

Cache support
3 participants