Skip to content

[dynamicIO] flush out top-level-await in segments before prospective render #78667

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

Draft
wants to merge 2 commits into
base: lubieowoce/dynamic-import-cache-tracking
Choose a base branch
from

Conversation

lubieowoce
Copy link
Member

No description provided.

Copy link
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lubieowoce lubieowoce changed the title move shared types out of next-app-loader/index [dynamicIO] flush out top-level-await in segments before prospective render Apr 29, 2025
@lubieowoce lubieowoce added the CI Bypass Graphite Optimization Ignore Graphite CI optimizations, run the full CI suite. https://graphite.dev/docs/stacking-and-ci label Apr 29, 2025
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from 5b283a6 to f3365c1 Compare April 29, 2025 13:46
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from 55b4b9f to b32c5a8 Compare April 29, 2025 13:46
@ijjk
Copy link
Member

ijjk commented Apr 29, 2025

Failing test suites

Commit: 46fa3fb

pnpm test-start test/e2e/app-dir/dynamic-io-dynamic-imports/dynamic-io-dynamic-imports.test.ts

  • async imports in dynamicIO > does not cause any routes to become (partially) dynamic
Expand output

● async imports in dynamicIO › does not cause any routes to become (partially) dynamic

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `async imports in dynamicIO does not cause any routes to become (partially) dynamic 1`

- Snapshot  - 0
+ Received  + 1

@@ -10,8 +10,9 @@
    "/inside-render/server/sync-module",
    "/outside-of-render/client/async-module",
    "/outside-of-render/client/sync-module",
    "/outside-of-render/server/async-module",
    "/outside-of-render/server/sync-module",
+   "/top-level-await-in-segment",
    "/top-level-await-in-segment/client",
    "/top-level-await-in-segment/server",
  ]

  39 |       }
  40 |
> 41 |       expect(prerenderedRoutes).toMatchInlineSnapshot(`
     |                                 ^
  42 |        [
  43 |          "/inside-render/client/async-module",
  44 |          "/inside-render/client/sync-module",

  at Object.toMatchInlineSnapshot (e2e/app-dir/dynamic-io-dynamic-imports/dynamic-io-dynamic-imports.test.ts:41:33)

Read more about building and testing Next.js in contributing.md.

pnpm test-start test/e2e/app-dir/segment-cache/basic/segment-cache-basic.test.ts

  • segment cache (basic tests) > navigate to page with lazily-generated (not at build time) static param
Expand output

● segment cache (basic tests) › navigate to page with lazily-generated (not at build time) static param

Expected a response containing the given string:

target-page-with-lazily-generated-param

  104 |     // Reveal the link to trigger a prefetch.
  105 |     const reveal = await browser.elementByCss('input[type="checkbox"]')
> 106 |     const link = await act(
      |                        ^
  107 |       async () => {
  108 |         await reveal.click()
  109 |         return await browser.elementByCss('a')

  at Object.act (e2e/app-dir/segment-cache/basic/segment-cache-basic.test.ts:106:24)

Read more about building and testing Next.js in contributing.md.

pnpm test-start test/e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts

  • segment cache (revalidation) > evict client cache when Server Action calls revalidatePath
  • segment cache (revalidation) > refetch visible Form components after cache is revalidated
  • segment cache (revalidation) > call router.prefetch(..., {onInvalidate}) after cache is revalidated
  • segment cache (revalidation) > evict client cache when Server Action calls revalidateTag
Expand output

● segment cache (revalidation) › evict client cache when Server Action calls revalidatePath

Expected a response containing the given string:

random-greeting [1]

  75 |     // corresponding entry to be evicted from the client cache, and a new
  76 |     // prefetch to be requested.
> 77 |     await act(
     |           ^
  78 |       async () => {
  79 |         const revalidateByPath = await browser.elementById('revalidate-by-path')
  80 |         await revalidateByPath.click()

  at Object.act (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:77:11)

● segment cache (revalidation) › refetch visible Form components after cache is revalidated

Expected a response containing the given string:

random-greeting

  114 |
  115 |     // Reveal the form that points to the target page to trigger a prefetch
> 116 |     await act(
      |           ^
  117 |       async () => {
  118 |         await formVisibilityToggle.click()
  119 |       },

  at Object.act (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:116:11)

● segment cache (revalidation) › call router.prefetch(..., {onInvalidate}) after cache is revalidated

Expected a response containing the given string:

random-greeting

  167 |
  168 |     // Reveal the link that points to the target page to trigger a prefetch
> 169 |     await act(
      |           ^
  170 |       async () => {
  171 |         await linkVisibilityToggle.click()
  172 |       },

  at Object.act (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:169:11)

● segment cache (revalidation) › evict client cache when Server Action calls revalidateTag

Expected a response containing the given string:

random-greeting

  214 |
  215 |     // Reveal the link the target page to trigger a prefetch.
> 216 |     await act(
      |           ^
  217 |       async () => {
  218 |         await linkVisibilityToggle.click()
  219 |       },

  at Object.act (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:216:11)

Read more about building and testing Next.js in contributing.md.

pnpm test test/integration/i18n-support-base-path/test/index.test.js (turbopack)

  • i18n Support basePath > development mode > should navigate with locale prop correctly
Expand output

● i18n Support basePath › development mode › should navigate with locale prop correctly

expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 8

- Array []
+ Array [
+   "[HMR] Invalid message: {\"action\":\"isrManifest\",\"data\":{\"/docsextra\":true,\"/docsextra/en\":true,\"/docsen\":true,\"/docs\":true,\"/_next/static/chunks/%5Broot-of-the-server%5D__0e1adba1._.js\":true,\"/_next/static/chunks/%5Broot-of-the-server%5D__7843b452._.js\":true,\"/_next/static/chunks/node_modules__pnpm_83df9126._.js\":true,\"/_next/static/chunks/pages/_app.js\":true,\"/_next/static/chunks/pages/404.js\":true,\"/_next/static/chunks/test_integration_i18n-support-base-path_pages__app_0cfb814e._.js\":true,\"/_next/static/chunks/test_integration_i18n-support-base-path_pages__app_5771e187._.js\":true,\"/_next/static/chunks/test_integration_i18n-support-base-path_pages_404_5771e187._.js\":true,\"/_next/static/chunks/test_integration_i18n-support-base-path_pages_404_ec678a9c._.js\":true,\"/_next/static/development/_buildManifest.js\":true,\"/_next/static/development/_ssgManifest.js\":true,\"/files/texts/file.txt\":true,\"/?query=1\":true,\"/gsp/fallback/mixed-not-found-redirect\":true,\"/gsp/fallback/first\":true,\"/gsp/no-fallback/first\":true,\"/dynamic/[slug]\":true,\"/\":true,\"/[post]\":true,\"/api/hello\":true,\"/api/post/first\":true}}
+ TypeError: Cannot read properties of undefined (reading 'components')
+     at handleStaticIndicator (http://localhost:44535/docs/_next/static/chunks/%5Broot-of-the-server%5D__0e1adba1._.js:12526:46)
+     at processMessage (http://localhost:44535/docs/_next/static/chunks/%5Broot-of-the-server%5D__0e1adba1._.js:12543:17)
+     at http://localhost:44535/docs/_next/static/chunks/%5Broot-of-the-server%5D__0e1adba1._.js:12407:13
+     at WebSocket.handleMessage (http://localhost:44535/docs/_next/static/chunks/%5Broot-of-the-server%5D__0e1adba1._.js:11878:17)",
+ ]

  2256 |     expect(parsedUrl.query).toEqual({})
  2257 |     expect(await browser.eval('window.beforeNav')).toBe(1)
> 2258 |     expect(await browser.eval('window.caughtWarns')).toEqual([])
       |                                                      ^
  2259 |   })
  2260 |
  2261 |   it('should navigate with locale prop correctly GSP', async () => {

  at Object.toEqual (integration/i18n-support/test/shared.js:2258:54)

Read more about building and testing Next.js in contributing.md.

@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from f3365c1 to 2ab6660 Compare April 29, 2025 15:46
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch 2 times, most recently from 451fe97 to ff35d80 Compare April 29, 2025 16:26
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from 2ab6660 to d410aa7 Compare April 29, 2025 16:26
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch 3 times, most recently from db920c6 to c15290a Compare April 29, 2025 18:55
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from 8c3b270 to 4476bbe Compare April 29, 2025 18:55
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from c15290a to 18d0a3b Compare April 29, 2025 19:01
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from 4476bbe to cd04058 Compare April 29, 2025 19:01
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from 18d0a3b to 46fa3fb Compare April 30, 2025 00:39
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from cd04058 to 1c164e1 Compare April 30, 2025 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Bypass Graphite Optimization Ignore Graphite CI optimizations, run the full CI suite. https://graphite.dev/docs/stacking-and-ci created-by: Next.js team PRs by the Next.js team. tests type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants