I encountered an error while using SvelteKit on Mobile Safari UI/WKWebView. The error occurs in the @sveltejs/kit/src/runtime/client/client.js file, specifically at line 1641. The error message is TypeError: undefined is not an object (evaluating 'a.x').
Environment:
Browser: Mobile Safari UI/WKWebView
Device: iPhone
Device Family: iPhone
Steps to Reproduce:
Open the application on Mobile Safari UI/WKWebView.
Perform a specific action that triggers scrolling.
Expected Behavior:
The application should scroll without errors.
Actual Behavior:
The error TypeError: undefined is not an object (evaluating 'a.x') is thrown during scrolling.
Additional Information:
I'm using Sentry to capture errors, and the issue seems to be related to the scrollTo(scroll.x, scroll.y); line in @sveltejs/kit/src/runtime/client/client.js.
Code Snippet:
addEventListener('popstate', async (event) => {
if (event.state?.[INDEX_KEY]) {
// if a popstate-driven navigation is cancelled, we need to counteract it
// with history.go, which means we end up back here, hence this check
if (event.state[INDEX_KEY] === current_history_index) return;
const scroll = scroll_positions[event.state[INDEX_KEY]];
// if the only change is the hash, we don't need to do anything...
if (current.url.href.split('#')[0] === location.href.split('#')[0]) {
// ...except handle scroll
scroll_positions[current_history_index] = scroll_state();
current_history_index = event.state[INDEX_KEY];
scrollTo(scroll.x, scroll.y);
return;
}
const delta = event.state[INDEX_KEY] - current_history_index;
await navigate({
url: new URL(location.href),
scroll,
keepfocus: false,
redirect_chain: [],
details: null,
accepted: () => {
current_history_index = event.state[INDEX_KEY];
},
blocked: () => {
history.go(-delta);
},
type: 'popstate',
delta
});
}
});
Description:
I encountered an error while using SvelteKit on Mobile Safari UI/WKWebView. The error occurs in the @sveltejs/kit/src/runtime/client/client.js file, specifically at line 1641. The error message is TypeError: undefined is not an object (evaluating 'a.x').
Environment:
Browser: Mobile Safari UI/WKWebView Device: iPhone Device Family: iPhone
Steps to Reproduce:
Open the application on Mobile Safari UI/WKWebView. Perform a specific action that triggers scrolling.
Expected Behavior:
The application should scroll without errors.
Actual Behavior:
The error TypeError: undefined is not an object (evaluating 'a.x') is thrown during scrolling.
Additional Information:
I'm using Sentry to capture errors, and the issue seems to be related to the scrollTo(scroll.x, scroll.y); line in @sveltejs/kit/src/runtime/client/client.js.
Code Snippet:
System Info