-
-
Notifications
You must be signed in to change notification settings - Fork 432
"scroll" is sometimes undefined in scrollTo(scroll.x, scroll.y) #1592
Comments
@Conduitry Is this an |
I also wonder why this was closed @Conduitry. I experience the same intermittent issue with "Cannot read property 'x' of undefined" as described above using latest Sapper (v0.28.10) |
I've opened a PR to make sure that |
@Conduitry, do you think we can open this issue? I've seen this error 14 times on production in the past two weeks. |
I can reproduce it:
Sapper stores/recovers only an id from the History API, not the scroll state. The first time we go back from the Svelte site to the application the browser takes care of the scroll, so no error happens. The next time, Sapper tries to restore the scroll position, but it can't because scroll data was gone in the moment we went outside the application (clicking the Svelte link). |
Looks like @rcabralc has reproduced this well. I'm seeing this too. Let's re-open this issue and evaluate my PR #1594? I think just checking for 🔔 Can we re-open this issue? @benmccann @Conduitry |
We also have this issue happening from time to time. TypeError: undefined is not an object (evaluating 'n.x')
File "webpack:///./src/node_modules/@sapper/app.mjs", line 225, in navigate
scrollTo(scroll.x, scroll.y);
File "[native code]", line unknown, in generatorResume
File "webpack:///./src/node_modules/@sapper/app.mjs", line 25, in __awaiter
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
File "[native code]", line unknown, in promiseReactionJob |
I re-implemented scroll tracking in SvelteKit so that it's both simpler and will work if you leave the site and come back I merged #1594 to avoid the issue in Sapper. Scroll history will be lost if you leave the site and come back, but the errors will no longer occur |
When it is planned to release the fixes listed in "Unreleased" section? |
From sveltejs/sapper#1592 Fix key highlighting on iOS.
Describe the bug
I got this error on our production website, tracked using Sentry:
Here's the link: https://sentry.io/share/issue/20ae1300a33f48f58457ffce7c96925a/
Fix
I was able to zero down on the line here: https://github.com/sveltejs/sapper/blob/master/runtime/src/app/router/index.ts#L223. It seems like sometimes
let scroll = scroll_history[id];
might be undefined, and then callingscrollTo(scroll.x, scroll.y)
throws an error. A proposed fix for this is to change:to:
Stacktraces
Information about your Sapper Installation:
npx envinfo --system --npmPackages svelte,sapper,rollup,webpack --binaries --browsers
Expand
Your hosting environment: AWS EC2 running a Docker container that serves the full-stack Sapper server
If it is an exported (
npm run export
) or dynamic application: DynamicThe text was updated successfully, but these errors were encountered: