[backport] Fix CSS HMR on Safari#92174
Conversation
Fixes #91818 **Regression source:** Commit `b7e4c6a011` ("Turbopack: transpile CHUNK_SUFFIX") introduced `getChunkSuffixFromScriptSrc()` which reads query strings from `<script>` tags. On Safari, this picks up the `?ts=` param injected by the server-side cache-busting workaround in `render.tsx` (for [WebKit into `ASSET_SUFFIX`. This causes HMR CSS URLs to match the preloaded URL exactly, re-triggering the Safari preload cache bug and preventing style updates. **Changes:** - **`dev-backend-dom.ts`**: Match existing `<link>` elements by base path (strip query string) so selectors work across HMR updates with different `?ts=` values. Add Safari to the Firefox cache-busting branch so new stylesheet links always get a fresh `?ts=`. - **`hmr-client.ts`**: Fix `mergeChunkUpdates` so a `total` update always supersedes any prior update type. (cherry picked from commit 8be5a3c)
bc422ce to
83064d3
Compare
Failing test suitesCommit: 83064d3 | About building and testing Next.js
Expand output● Client navigation with URL hash › when hash changes with state › when passing state via hash change › should increment the shallow history state counter
Expand output● layout sharing in non-static prefetches › full prefetches should omit layouts that were already prefetched with a full prefetch ● layout sharing in non-static prefetches › navigations should omit layouts that were already prefetched with a full prefetch ● layout sharing in non-static prefetches › segment-level prefetch config › statically prefetches a fully-static page segment if all its runtime-prefetchable parents are available
Expand output● css-data-url-global-pages › should apply styles from data url correctly
Expand output● use-cache › should revalidate caches during on-demand revalidation |
Stats from current PR🟢 1 improvement
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (25 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-exp..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page.runtime.dev.jsfailed to diffapp-page.runtime.prod.jsfailed to diffapp-route-ex..ntime.dev.jsDiff too large to display app-route-ex..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route.runtime.dev.jsDiff too large to display app-route.ru..time.prod.jsDiff too large to display pages-api-tu..ntime.dev.jsDiff too large to display pages-api-tu..time.prod.jsDiff too large to display pages-api.runtime.dev.jsDiff too large to display pages-api.ru..time.prod.jsDiff too large to display pages-turbo...ntime.dev.jsDiff too large to display pages-turbo...time.prod.jsDiff too large to display pages.runtime.dev.jsDiff too large to display pages.runtime.prod.jsDiff too large to display server.runtime.prod.jsDiff too large to display 📎 Tarball URL |
Merging this PR will degrade performance by 5.04%
Performance Changes
Comparing Footnotes
|
Summary
next-16-2release branchTest plan
UPDATE=1 cargo nextest r -p turbopack-tests— all 297 tests passpnpm build-all— clean build, no issues withgenerated-native.d.ts