Skip to content

[pull] canary from vercel:canary #89

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

Merged
merged 3 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:

jobs:
deploy-target:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
outputs:
value: ${{ steps.deploy-target.outputs.value }}
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "15.4.0-canary.18"
"version": "15.4.0-canary.19"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/api-reference/config/eslint",
"dependencies": {
"@next/eslint-plugin-next": "15.4.0-canary.18",
"@next/eslint-plugin-next": "15.4.0-canary.19",
"@rushstack/eslint-patch": "^1.10.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/font",
"private": true,
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-rspack",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-rspack"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"private": true,
"files": [
"native/"
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -100,7 +100,7 @@
]
},
"dependencies": {
"@next/env": "15.4.0-canary.18",
"@next/env": "15.4.0-canary.19",
"@swc/helpers": "0.5.15",
"caniuse-lite": "^1.0.30001579",
"postcss": "8.4.31",
Expand Down Expand Up @@ -162,11 +162,11 @@
"@jest/types": "29.5.0",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/font": "15.4.0-canary.18",
"@next/polyfill-module": "15.4.0-canary.18",
"@next/polyfill-nomodule": "15.4.0-canary.18",
"@next/react-refresh-utils": "15.4.0-canary.18",
"@next/swc": "15.4.0-canary.18",
"@next/font": "15.4.0-canary.19",
"@next/polyfill-module": "15.4.0-canary.19",
"@next/polyfill-nomodule": "15.4.0-canary.19",
"@next/react-refresh-utils": "15.4.0-canary.19",
"@next/swc": "15.4.0-canary.19",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@storybook/addon-a11y": "8.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/third-parties/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/third-parties",
"version": "15.4.0-canary.18",
"version": "15.4.0-canary.19",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
Expand All @@ -26,7 +26,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "15.4.0-canary.18",
"next": "15.4.0-canary.19",
"outdent": "0.8.0",
"prettier": "2.5.1",
"typescript": "5.8.2"
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 69 additions & 25 deletions test/e2e/app-dir/back-forward-cache/back-forward-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'

describe('back/forward cache', () => {
const { next } = nextTestSetup({
Expand All @@ -9,10 +10,17 @@ describe('back/forward cache', () => {
const browser = await next.browser('/page/1')

// Accumulate some state on page 1.
const incrementButton1 = await browser.elementById('increment-button-1')
await retry(async () => {
// we do this inside of retry in case button event handler
// isn't ready yet
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
expect(await counterDisplay1.text()).toBe('Count: 1')
})
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
await incrementButton1.click()
await incrementButton1.click()
expect(await counterDisplay1.text()).toBe('Count: 2')

// Navigate to page 2. Accumulate some state here, too.
Expand Down Expand Up @@ -48,10 +56,18 @@ describe('back/forward cache', () => {
const browser = await next.browser('/page/1')

// Accumulate some state on page 1.
const incrementButton1 = await browser.elementById('increment-button-1')
// Accumulate some state on page 1.
await retry(async () => {
// we do this inside of retry in case button event handler
// isn't ready yet
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
expect(await counterDisplay1.text()).toBe('Count: 1')
})
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
await incrementButton1.click()
await incrementButton1.click()
expect(await counterDisplay1.text()).toBe('Count: 2')

// Navigate to page 2. Accumulate some state here, too.
Expand Down Expand Up @@ -88,10 +104,17 @@ describe('back/forward cache', () => {
const browser = await next.browser('/page/1')

// Accumulate some state on page 1.
const incrementButton1 = await browser.elementById('increment-button-1')
await retry(async () => {
// we do this inside of retry in case button event handler
// isn't ready yet
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
expect(await counterDisplay1.text()).toBe('Count: 1')
})
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
await incrementButton1.click()
await incrementButton1.click()
expect(await counterDisplay1.text()).toBe('Count: 2')

// Navigate to page 2.
Expand All @@ -103,27 +126,38 @@ describe('back/forward cache', () => {
'a[href="/page/1?param=true"]'
)
await linkToPage1WithSearchParam.click()
const counterDisplay1AfterNav =
await browser.elementById('counter-display-1')
const hasSearchParam = await browser.elementById('has-search-param-1')
expect(await counterDisplay1AfterNav.text()).toBe('Count: 2')
expect(await hasSearchParam.text()).toBe('Has search param: yes')

await retry(async () => {
const counterDisplay1AfterNav =
await browser.elementById('counter-display-1')
const hasSearchParam = await browser.elementById('has-search-param-1')
expect(await counterDisplay1AfterNav.text()).toBe('Count: 2')
expect(await hasSearchParam.text()).toBe('Has search param: yes')
})
})

it('bfcache only preserves up to N entries', async () => {
// The current limit is hardcoded to 3.
const browser = await next.browser('/page/1')

// Accumulate some state on page 1.
const incrementButton1 = await browser.elementById('increment-button-1')
await retry(async () => {
// we do this inside of retry in case button event handler
// isn't ready yet
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
expect(await counterDisplay1.text()).toBe('Count: 1')
})
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
await incrementButton1.click()
await incrementButton1.click()
expect(await counterDisplay1.text()).toBe('Count: 2')

// Navigate to page 2. Accumulate some state here, too.
const linkToPage2 = await browser.elementByCss('a[href="/page/2"]')
await linkToPage2.click()

const incrementButton2 = await browser.elementById('increment-button-2')
const counterDisplay2 = await browser.elementById('counter-display-2')
await incrementButton2.click()
Expand Down Expand Up @@ -153,22 +187,32 @@ describe('back/forward cache', () => {
expect(await counterDisplay2AfterNav.text()).toBe('Count: 9')

// Navigate back to page 1 to confirm its state is not preserved.
const linkToPage1 = await browser.elementByCss('a[href="/page/1"]')
await linkToPage1.click()
const counterDisplay1AfterNav =
await browser.elementById('counter-display-1')
expect(await counterDisplay1AfterNav.text()).toBe('Count: 0')
await retry(async () => {
const linkToPage1 = await browser.elementByCss('a[href="/page/1"]')
await linkToPage1.click()

const counterDisplay1AfterNav =
await browser.elementById('counter-display-1')
expect(await counterDisplay1AfterNav.text()).toBe('Count: 0')
})
})

it('navigate back and forth repeatedly between the same pages without evicting', async () => {
// The current limit is hardcoded to 3.
const browser = await next.browser('/page/1')

// Accumulate some state on page 1.
const incrementButton1 = await browser.elementById('increment-button-1')
await retry(async () => {
// we do this inside of retry in case button event handler
// isn't ready yet
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
expect(await counterDisplay1.text()).toBe('Count: 1')
})
await browser.elementById('increment-button-1').click()

const counterDisplay1 = await browser.elementById('counter-display-1')
await incrementButton1.click()
await incrementButton1.click()
expect(await counterDisplay1.text()).toBe('Count: 2')

// Navigate to page 2. Accumulate some state here, too.
Expand Down
Loading