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

Using Sentry's SvelteKit SDK breaks preloading / SSR #5871

Closed
kevinrenskers opened this issue Aug 15, 2023 · 1 comment
Closed

Using Sentry's SvelteKit SDK breaks preloading / SSR #5871

kevinrenskers opened this issue Aug 15, 2023 · 1 comment

Comments

@kevinrenskers
Copy link

kevinrenskers commented Aug 15, 2023

Describe the bug

When using Sentry's new SvelteKit SDK, the preloading / SSR functionality of TanStack Query for Svelte seems broken. This happens when you include Sentry's SvelteKit plugin which modifies the fetch function.

Your minimal, reproducible example

https://github.com/kevinrenskers/sveltequery-sentry-sveltekit

Steps to reproduce

  1. Clone my https://github.com/kevinrenskers/sveltequery-sentry-sveltekit repo and npm install
  2. npm run dev, open http://127.0.0.1:5173
  3. Open the javascript console and then click on the "Articles" link in the top

You will see that the posts array is first undefined, and then it gets data:

Screenshot 2023-08-15 at 14 29 45

Now edit vite.config.ts and remove sentrySvelteKit() from the plugins. Restart the dev server and do the same thing again: start on the homepage and then go to articles. Now the posts array is immediately defined:

Screenshot 2023-08-15 at 14 28 47

It does have a real effect in my website, where articles pop in a fraction of a second later instead of already being there. Basically SSR seems broken.

Expected behavior

I don't know if the problem lies with Sentry's sentrySvelteKit Vite plugin which definitely modifies the fetch function, or if the problem lies with Query which can't deal with these changes. But I would expect that installing Sentry's SvelteKit SDK and their Vite plugin to not change the behavior of my site when using Query.

Also reported in their repo: getsentry/sentry-javascript#8818

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Unrelated to browser or OS.

Tanstack Query adapter

svelte-query

TanStack Query version

4.32.6

TypeScript version

No response

Additional context

No response

@kevinrenskers
Copy link
Author

Well it seems it's indeed a problem with SvelteKit's SDK and they are already working on a PR that fixes this. I think you can probably close this ticket.

@TkDodo TkDodo closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants