Skip to content

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

@peterpeterparker

Description

@peterpeterparker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions