From 27017925161c2abd63764c3615266e9a2bacd79f Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sat, 28 Jan 2023 11:24:06 -0800 Subject: [PATCH 1/3] Update more flakey API support checks (#45373) x-ref: https://github.com/vercel/next.js/actions/runs/4033048662/jobs/6933337411 --- .../api-support/test/index.test.js | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/test/integration/api-support/test/index.test.js b/test/integration/api-support/test/index.test.js index 4e66350ac15c5..56fb54a75897b 100644 --- a/test/integration/api-support/test/index.test.js +++ b/test/integration/api-support/test/index.test.js @@ -308,16 +308,24 @@ function runTests(dev = false) { it('should show friendly error for invalid redirect', async () => { await fetchViaHTTP(appPort, '/api/redirect-error', null, {}) - expect(stderr).toContain( - `Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').` - ) + + await check(() => { + expect(stderr).toContain( + `Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').` + ) + return 'yes' + }, 'yes') }) it('should show friendly error in case of passing null as first argument redirect', async () => { await fetchViaHTTP(appPort, '/api/redirect-null', null, {}) - expect(stderr).toContain( - `Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').` - ) + + check(() => { + expect(stderr).toContain( + `Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').` + ) + return 'yes' + }, 'yes') }) it('should redirect with status code 307', async () => { @@ -547,10 +555,14 @@ function runTests(dev = false) { it('should show false positive warning if not using externalResolver flag', async () => { const apiURL = '/api/external-resolver-false-positive' const req = await fetchViaHTTP(appPort, apiURL) - expect(stderr).toContain( - `API resolved without sending a response for ${apiURL}, this may result in stalled requests.` - ) expect(await req.text()).toBe('hello world') + + check(() => { + expect(stderr).toContain( + `API resolved without sending a response for ${apiURL}, this may result in stalled requests.` + ) + return 'yes' + }, 'yes') }) it('should not show warning if using externalResolver flag', async () => { From 83d6a437f249e277a38c0d4f24f14c7f40a68f03 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sat, 28 Jan 2023 20:36:14 +0100 Subject: [PATCH 2/3] Add shared mutable type in router-reducer (#45369) Preparation for making the mutable shared across the actions. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) --- .../router-reducer/router-reducer-types.ts | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/next/src/client/components/router-reducer/router-reducer-types.ts b/packages/next/src/client/components/router-reducer/router-reducer-types.ts index cb9c9eb2e7ae4..d8063c15de3df 100644 --- a/packages/next/src/client/components/router-reducer/router-reducer-types.ts +++ b/packages/next/src/client/components/router-reducer/router-reducer-types.ts @@ -8,6 +8,14 @@ export const ACTION_RESTORE = 'restore' export const ACTION_SERVER_PATCH = 'server-patch' export const ACTION_PREFETCH = 'prefetch' +export interface Mutable { + mpaNavigation?: boolean + previousTree?: FlightRouterState + patchedTree?: FlightRouterState + canonicalUrlOverride?: string + useExistingCache?: true +} + /** * Refresh triggers a refresh of the full page data. * - fetches the Flight data and fills subTreeData at the root of the cache. @@ -16,12 +24,7 @@ export const ACTION_PREFETCH = 'prefetch' export interface RefreshAction { type: typeof ACTION_REFRESH cache: CacheNode - mutable: { - previousTree?: FlightRouterState - patchedTree?: FlightRouterState - mpaNavigation?: boolean - canonicalUrlOverride?: string - } + mutable: Mutable } /** @@ -65,13 +68,7 @@ export interface NavigateAction { navigateType: 'push' | 'replace' forceOptimisticNavigation: boolean cache: CacheNode - mutable: { - mpaNavigation?: boolean - previousTree?: FlightRouterState - patchedTree?: FlightRouterState - canonicalUrlOverride?: string - useExistingCache?: true - } + mutable: Mutable } /** @@ -98,11 +95,7 @@ export interface ServerPatchAction { previousTree: FlightRouterState overrideCanonicalUrl: URL | undefined cache: CacheNode - mutable: { - patchedTree?: FlightRouterState - mpaNavigation?: boolean - canonicalUrlOverride?: string - } + mutable: Mutable } /** From b0cf24137e54728f99816b076054a59a2c1bd075 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sat, 28 Jan 2023 12:27:12 -0800 Subject: [PATCH 3/3] Remove old CI workflows (#45377) These workflows are no longer necessary as `react@next` is now included in Next.js itself for app dir. x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1674039337638229) --- .github/workflows/test_react_experimental.yml | 51 ------------------- .github/workflows/test_react_next.yml | 51 ------------------- 2 files changed, 102 deletions(-) delete mode 100644 .github/workflows/test_react_experimental.yml delete mode 100644 .github/workflows/test_react_next.yml diff --git a/.github/workflows/test_react_experimental.yml b/.github/workflows/test_react_experimental.yml deleted file mode 100644 index 75bf18a6a42fa..0000000000000 --- a/.github/workflows/test_react_experimental.yml +++ /dev/null @@ -1,51 +0,0 @@ -on: - schedule: - # * is a special character in YAML so you have to quote this string - - cron: '0 0,12 * * *' - -name: Test react@experimental - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - run: yarn install --frozen-lockfile --check-files - env: - NEXT_TELEMETRY_DISABLED: 1 - - - run: yarn upgrade react@experimental react-dom@experimental -W --dev - - - run: node run-tests.js --timings --write-timings -g 1/1 - - - uses: actions/cache@v3 - id: cache-build - with: - path: ./* - key: ${{ github.sha }}-react-experimental - - testAll: - name: Test All - runs-on: ubuntu-latest - needs: build - env: - NEXT_TELEMETRY_DISABLED: 1 - NEXT_PRIVATE_REACT_ROOT: 1 - NEXT_PRIVATE_SKIP_SIZE_TESTS: true - strategy: - fail-fast: false - matrix: - group: [1, 2, 3, 4, 5, 6] - steps: - - uses: actions/cache@v3 - id: restore-build - with: - path: ./* - key: ${{ github.sha }}-react-experimental - - - run: npm i -g pnpm@latest - - - run: npm i -g playwright-chromium@1.28.1 && npx playwright install-deps - - - run: node run-tests.js --timings -g ${{ matrix.group }}/6 diff --git a/.github/workflows/test_react_next.yml b/.github/workflows/test_react_next.yml deleted file mode 100644 index 7c006a6d1fda7..0000000000000 --- a/.github/workflows/test_react_next.yml +++ /dev/null @@ -1,51 +0,0 @@ -on: - schedule: - # * is a special character in YAML so you have to quote this string - - cron: '0 0,12 * * *' - -name: Test react@next - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - run: yarn install --frozen-lockfile --check-files - env: - NEXT_TELEMETRY_DISABLED: 1 - - - run: yarn upgrade react@next react-dom@next -W --dev - - - run: node run-tests.js --timings --write-timings -g 1/1 - - - uses: actions/cache@v3 - id: cache-build - with: - path: ./* - key: ${{ github.sha }}-react-next - - testAll: - name: Test All - runs-on: ubuntu-latest - needs: build - env: - NEXT_TELEMETRY_DISABLED: 1 - NEXT_PRIVATE_REACT_ROOT: 1 - NEXT_PRIVATE_SKIP_SIZE_TESTS: true - strategy: - fail-fast: false - matrix: - group: [1, 2, 3, 4, 5, 6] - steps: - - uses: actions/cache@v3 - id: restore-build - with: - path: ./* - key: ${{ github.sha }}-react-next - - - run: npm i -g pnpm@latest - - - run: npm i -g playwright-chromium@1.28.1 && npx playwright install-deps - - - run: node run-tests.js --timings -g ${{ matrix.group }}/6