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

Cannot read properties of undefined (reading 'disable_scroll_handling') #7415

Closed
peterpeterparker opened this issue Oct 28, 2022 · 6 comments
Labels
Milestone

Comments

@peterpeterparker
Copy link

peterpeterparker commented Oct 28, 2022

Describe the bug

When I use afterNavigate, beforeNavigate or goto in a +page while using the adapter static and the chunking strategy of vite (splitVendorChunkPlugin) I get an error Uncaught TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling') at runtime.

Note:

Possible related issue #4432 and #1485

Capture d’écran 2022-10-28 à 07 23 32

Reproduction

git clone https://github.com/peterpeterparker/my-app-yolo
cd my-app-yolo
npm ci
npm run build
npx serve build

Logs

vendor-67141009.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling')
    at vendor-67141009.js:1:35550
(anonymous) @ vendor-67141009.js:1
2vendor-67141009.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling')
    at vendor-67141009.js:1:35550

System Info

System:
    OS: macOS 12.6
    CPU: (8) arm64 Apple M2
    Memory: 762.14 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - /usr/local/bin/node
    npm: 8.19.2 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 106.0.5249.119
    Firefox: 106.0.2
    Safari: 16.0
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.84 
    @sveltejs/adapter-static: ^1.0.0-next.46 => 1.0.0-next.46 
    @sveltejs/kit: next => 1.0.0-next.525 
    svelte: ^3.44.0 => 3.52.0 
    vite: ^3.1.0 => 3.1.8

Severity

serious, but I can work around it

Additional Information

Workarounds:

  • load goto with const {goto} = await import('$app/navigation')

  • no direct workaround to use afterNavigate. instead I used a custom store in which I track which pages where visited

@dummdidumm
Copy link
Member

I don't know if it's possible to use this chunking strategy with SvelteKit. All the $app/X imports are tightly connected to the running app - for example the route manifest. I don't know how the chunking strategy works exactly, but if it just moves everything within @sveltejs/kit into one vendor chunk, that won't work.

@dummdidumm dummdidumm added this to the whenever milestone Nov 17, 2022
@muzidudu
Copy link

muzidudu commented Mar 5, 2023

I also encountered this problem when using rollupOptions.output.manualChunks

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling')
    at vendor.c321e0ef.js:3:9569

@justingolden21
Copy link

Experiencing this too; it crashes the entire webpage. Refreshing fixes it. I don't want to ship code to my users that crashes the first time they load the page though.

image
image

TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling')
    at navigation.js?v=9f0f29a7:14:11
handleError @ app.js:28
handle_error @ client.js?v=7a176f0d:1339
_hydrate @ client.js?v=7a176f0d:1789
await in _hydrate (async)
start @ start.js:22
(anonymous) @ stopwatch:3076
Promise.then (async)
(anonymous) @ stopwatch:3075
navigation.js?v=9f0f29a7:14 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling')
    at navigation.js?v=9f0f29a7:14:11
(anonymous) @ navigation.js?v=9f0f29a7:14
navigation.js?v=9f0f29a7:14 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling')
    at navigation.js?v=9f0f29a7:14:11

@MelodicCrypter
Copy link

I'm also experiencing the "disable_scroll_handling" issue

Screenshot 2023-04-14 at 1 58 30 PM

Using: "@sveltejs/kit": "^1.15.5"

@godmar
Copy link

godmar commented Apr 18, 2023

I'm experiencing the same issue, and const {goto} = await import('$app/navigation') does not work as a work-around.

Why is this issue scheduled for whenever?

How do people make production builds with this not working?

@gtm-nayan
Copy link
Contributor

fixed by #9808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants