Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Updates to the session store when rendering _error.svelte causes a TypeError #1755

Open
AaronDDM opened this issue Mar 23, 2021 · 0 comments

Comments

@AaronDDM
Copy link

Describe the bug
If you are on a 404 page handled by Sapper and your code (e.g. in the _layout.svelte file) updates the session store, you'll notice a TypeError in your console logs.

Logs

Uncaught (in promise) TypeError: Cannot destructure property 'route' of 'dest' as it is undefined.

To Reproduce
https://github.com/AaronDDM/sapper-store-update-bug/blob/main/src/routes/_layout.svelte

  1. Check out the above repo
  2. Start your server via npm run dev
  3. Visit a URL that does not exist (e.g. http://localhost:3000/ARouteThatDoesNotExist)
  4. Open your browser console logs
  5. Refresh the page

Expected behavior
No type error.

Stacktraces
If you have a stack trace to include, we recommend putting inside a <details> block for the sake of the thread's readability:

Stack trace
  (anonymous) @ app.mjs:455
  (anonymous) @ app.mjs:28
  __awaiter @ app.mjs:24
  hydrate_target @ app.mjs:454
  (anonymous) @ app.mjs:334
  (anonymous) @ app.mjs:28
  __awaiter @ app.mjs:24
  (anonymous) @ app.mjs:327
  set @ index.mjs:35
  update @ index.mjs:43
  (anonymous) @ _layout.svelte:11
  Promise.then (async)    
  step @ app.mjs:27
  (anonymous) @ app.mjs:28
  __awaiter @ app.mjs:24
  (anonymous) @ app.mjs:327
  set @ index.mjs:35
  update @ index.mjs:43
  (anonymous) @ _layout.svelte:11
  setTimeout (async)    
  instance$2 @ _layout.svelte:10
  init$1 @ index.mjs:1474
  Layout @ _layout.svelte:17
  create_fragment @ App.svelte:20
  init$1 @ index.mjs:1489
  App @ App.svelte:17
  (anonymous) @ app.mjs:424
  fulfilled @ app.mjs:25
  Promise.then (async)    
  step @ app.mjs:27
  (anonymous) @ app.mjs:28
  __awaiter @ app.mjs:24
  render @ app.mjs:408
  handle_error @ app.mjs:382
  (anonymous) @ app.mjs:354
  Promise.then (async)    
  start$1 @ app.mjs:353
  (anonymous) @ client.js:3
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant