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 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 } /** 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 () => {