Skip to content
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

Fix Script beforeInteractive on navigation #26995

Merged
merged 4 commits into from
Jul 15, 2021

Conversation

janicklas-ralph
Copy link
Contributor

Bug

Documentation / Examples

  • Make sure the linting passes

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
xen0n WÁNG Xuěruì
@ijjk

This comment has been minimized.

@ijjk
Copy link
Member

ijjk commented Jul 7, 2021

Failing test suites

Commit: 1a7a983

test/integration/script-loader/test/index.test.js

  • Script Loader > priority afterInteractive
Expand output

● Script Loader › priority afterInteractive

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  50 |         expect(script).toBeDefined()
  51 |         // Script is inserted at the end
> 52 |         expect(endScripts.length).toBe(0)
     |                                   ^
  53 |       }
  54 |
  55 |       // afterInteractive script in page

  at test (integration/script-loader/test/index.test.js:52:35)
  at Object.<anonymous> (integration/script-loader/test/index.test.js:56:7)

timneutkens
timneutkens previously approved these changes Jul 8, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
xen0n WÁNG Xuěruì

Verified

This commit was signed with the committer’s verified signature. The key has expired.
xen0n WÁNG Xuěruì
@ijjk

This comment has been minimized.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
xen0n WÁNG Xuěruì
@ijjk
Copy link
Member

ijjk commented Jul 15, 2021

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary janicklas-ralph/next.js script Change
buildDuration 15.7s 16.2s ⚠️ +539ms
buildDurationCached 3.7s 3.4s -228ms
nodeModulesSize 49.4 MB 49.4 MB ⚠️ +105 B
Page Load Tests Overall increase ✓
vercel/next.js canary janicklas-ralph/next.js script Change
/ failed reqs 0 0
/ total time (seconds) 2.817 2.79 -0.03
/ avg req/sec 887.5 895.96 +8.46
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.64 1.605 -0.03
/error-in-render avg req/sec 1524.24 1557.57 +33.33
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary janicklas-ralph/next.js script Change
359.HASH.js gzip 2.96 kB 2.96 kB
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 20.9 kB 20.9 kB ⚠️ +4 B
webpack-HASH.js gzip 1.49 kB 1.49 kB
Overall change 67.4 kB 67.4 kB ⚠️ +4 B
Legacy Client Bundles (polyfills)
vercel/next.js canary janicklas-ralph/next.js script Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary janicklas-ralph/next.js script Change
_app-HASH.js gzip 803 B 803 B
_error-HASH.js gzip 3.06 kB 3.06 kB
amp-HASH.js gzip 554 B 554 B
css-HASH.js gzip 329 B 329 B
hooks-HASH.js gzip 903 B 903 B
image-HASH.js gzip 5.6 kB 5.6 kB
index-HASH.js gzip 261 B 261 B
link-HASH.js gzip 1.66 kB 1.66 kB
routerDirect..HASH.js gzip 319 B 319 B
withRouter-HASH.js gzip 320 B 320 B
bb14e60e810b..30f.css gzip 125 B 125 B
Overall change 13.9 kB 13.9 kB
Client Build Manifests
vercel/next.js canary janicklas-ralph/next.js script Change
_buildManifest.js gzip 417 B 417 B
Overall change 417 B 417 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary janicklas-ralph/next.js script Change
index.html gzip 531 B 529 B -2 B
link.html gzip 545 B 543 B -2 B
withRouter.html gzip 526 B 523 B -3 B
Overall change 1.6 kB 1.59 kB -7 B

Diffs

Diff for main-HASH.js
@@ -3251,6 +3251,8 @@
               )
             ]);
             updateScripts(scripts);
+          } else {
+            loadScript(props);
           }
         }
Diff for index.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-97d1ae727580da3f23c3.js"
+      src="/_next/static/chunks/main-3c34c120970fcdede460.js"
       defer=""
     ></script>
     <script
Diff for link.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-97d1ae727580da3f23c3.js"
+      src="/_next/static/chunks/main-3c34c120970fcdede460.js"
       defer=""
     ></script>
     <script
Diff for withRouter.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-97d1ae727580da3f23c3.js"
+      src="/_next/static/chunks/main-3c34c120970fcdede460.js"
       defer=""
     ></script>
     <script

Webpack 4 Mode
General Overall increase ⚠️
vercel/next.js canary janicklas-ralph/next.js script Change
buildDuration 12.3s 12.3s -26ms
buildDurationCached 5s 4.8s -259ms
nodeModulesSize 49.4 MB 49.4 MB ⚠️ +105 B
Page Load Tests Overall increase ✓
vercel/next.js canary janicklas-ralph/next.js script Change
/ failed reqs 0 0
/ total time (seconds) 2.793 2.7 -0.09
/ avg req/sec 894.95 925.77 +30.82
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.635 1.668 ⚠️ +0.03
/error-in-render avg req/sec 1529.16 1498.97 ⚠️ -30.19
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary janicklas-ralph/next.js script Change
14.HASH.js gzip 2.98 kB 2.98 kB
677f882d2ed8..HASH.js gzip 13.7 kB 13.7 kB
framework.HASH.js gzip 41.8 kB 41.8 kB
main-HASH.js gzip 8.39 kB 8.39 kB ⚠️ +3 B
webpack-HASH.js gzip 1.19 kB 1.19 kB
Overall change 68 kB 68 kB ⚠️ +3 B
Legacy Client Bundles (polyfills)
vercel/next.js canary janicklas-ralph/next.js script Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary janicklas-ralph/next.js script Change
_app-HASH.js gzip 791 B 791 B
_error-HASH.js gzip 3.76 kB 3.76 kB
amp-HASH.js gzip 552 B 552 B
css-HASH.js gzip 333 B 333 B
hooks-HASH.js gzip 910 B 910 B
index-HASH.js gzip 230 B 230 B
link-HASH.js gzip 1.64 kB 1.64 kB
routerDirect..HASH.js gzip 297 B 297 B
withRouter-HASH.js gzip 293 B 293 B
e025d2764813..52f.css gzip 125 B 125 B
Overall change 8.93 kB 8.93 kB
Client Build Manifests
vercel/next.js canary janicklas-ralph/next.js script Change
_buildManifest.js gzip 420 B 420 B
Overall change 420 B 420 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary janicklas-ralph/next.js script Change
index.html gzip 576 B 576 B
link.html gzip 590 B 590 B
withRouter.html gzip 568 B 569 B ⚠️ +1 B
Overall change 1.73 kB 1.74 kB ⚠️ +1 B

Diffs

Diff for main-HASH.js
@@ -648,6 +648,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
               )
             ]);
             updateScripts(scripts);
+          } else {
+            loadScript(props);
           }
         }
Diff for index.html
@@ -23,7 +23,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-8fbd1c5f9ebeff7969a4.js"
+      src="/_next/static/chunks/main-e23273667ac2b2f248c1.js"
       defer=""
     ></script>
     <script
Diff for link.html
@@ -23,7 +23,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-8fbd1c5f9ebeff7969a4.js"
+      src="/_next/static/chunks/main-e23273667ac2b2f248c1.js"
       defer=""
     ></script>
     <script
Diff for withRouter.html
@@ -23,7 +23,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-8fbd1c5f9ebeff7969a4.js"
+      src="/_next/static/chunks/main-e23273667ac2b2f248c1.js"
       defer=""
     ></script>
     <script
Commit: 173a1d1

@kodiakhq kodiakhq bot merged commit 3b388c3 into vercel:canary Jul 15, 2021
@janicklas-ralph janicklas-ralph deleted the script branch July 16, 2021 02:42
javivelasco pushed a commit to javivelasco/next.js that referenced this pull request Jul 21, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
xen0n WÁNG Xuěruì
- [x] fixes vercel#26342
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`

- [x] Make sure the linting passes
flybayer pushed a commit to blitz-js/next.js that referenced this pull request Aug 19, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
xen0n WÁNG Xuěruì
## Bug

- [x] fixes vercel#26342 
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`


## Documentation / Examples

- [x] Make sure the linting passes
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

next/script is not loading when navigating between pages
3 participants