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

Ensure latest canary of Next.js is installed in repros #65197

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Ensure latest canary of Next.js is installed in repros #65197

merged 1 commit into from
Apr 30, 2024

Conversation

karlhorky
Copy link
Contributor

@karlhorky karlhorky commented Apr 30, 2024

What?

Always use latest canary in reproduction templates

Why?

Following up with the new PR #64967, it appears that CodeSandbox caches package.json and the changes made to it from pnpm update next - which uses an outdated canary version of Next.js

Eg. currently, the reproduction template URL uses next@14.3.0-canary.26 is not the latest canary

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template

Screenshot 2024-04-30 at 12 44 24

How?

Switch CodeSandbox "dev" task to update the pinned canary version of Next.js in the cached package.json to the latest Next.js canary:

  • old: pnpm update next
  • new: pnpm update next@canary
$ pnpm update next@canary
Packages: +4 -4
++++----
Progress: resolved 65, reused 43, downloaded 0, added 0, done

dependencies:
- next 14.3.0-canary.26
+ next 14.3.0-canary.32

Done in 2.9s

This will:

A) upgrade the pinned version in the cached package.json file
B) perform this upgrade on forking of the sandbox (because of restartOn.clone = true)

Caveats

Users restarting the dev task for any reason will get the (potentially unwanted) side effect of upgrading Next.js to the latest canary:

1.⁠ User creates a reproduction on a certain canary version
2.⁠ ⁠⁠New canary version is released
3.⁠ ⁠⁠User restarts the dev task for any reason
4.⁠ ⁠⁠Next.js version updated, potentially leading to the bug disappearing from the reproduction (URL may be published somewhere publicly) 💥

This could be seen as unexpected behavior / a "paper cut".

However, it seems like the tradeoff is worth it, as having the latest canary on all new reproductions is higher value than allowing the potential (less common) action of restarting the dev task in a devbox.

In future, I would however like to explore solutions with CodeSandbox that will allow for restarting the dev server without this unwanted side effect, eg. potentially with an environment variable or something similar.

cc @styfle

@ijjk ijjk added the examples Issue was opened via the examples template. label Apr 30, 2024
@ijjk
Copy link
Member

ijjk commented Apr 30, 2024

Allow CI Workflow Run

  • approve CI run for commit: cd842b6

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@karlhorky karlhorky marked this pull request as ready for review April 30, 2024 10:52
@karlhorky karlhorky requested review from a team as code owners April 30, 2024 10:52
@karlhorky karlhorky requested review from manovotny and delbaoliveira and removed request for a team April 30, 2024 10:52
@balazsorban44 balazsorban44 merged commit 03c8780 into vercel:canary Apr 30, 2024
31 of 35 checks passed
@karlhorky
Copy link
Contributor Author

@balazsorban44 thanks for the review and merge! 🙌

I'll check back once a new canary after 14.3.0-canary.32 is published, hopefully at that time, navigating to the link below and then forking will lead to the latest version being installed:

@karlhorky karlhorky deleted the pnpm-update-next-canary branch April 30, 2024 17:11
@karlhorky
Copy link
Contributor Author

karlhorky commented May 1, 2024

Confirmed, the pnpm update next@canary command automatically updates to the latest canary on fork of the reproduction sandbox above (next@14.3.0-canary.33 installed after update command):

Screenshot 2024-05-01 at 11 01 22

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template. locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants