Skip to content

[Sveltekit] Sveltekit auto instrumentation in vite plugin causes load functions to invalidate on every route change #8610

Closed
@madeleineostoja

Description

@madeleineostoja

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/sveltekit

SDK Version

7.57.0

Framework Version

Sveltekit 1.22.1

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

  1. Add Sentry's load instrumentation via the vite plugin for Svetlekit as outlined in the docs
  2. Create a +layout.server.ts in the root of the project
  3. See it re-run on every single route change despite having no dependencies on url/params/etc

Expected Result

Layout load should not re-run unless its dependencies change or its explicitly invalidated

Actual Result

Layout load is invalidated on every route change, due to Sentry's instrumentation of load.

Adding autoInstrument: false to the vite plugin options resolves the issue.

Took me AGES to debug why my loads were rerunning constantly, breaking my app (I hydrate stores when they first run, and rehydrate on manual invalidation). This should be a huge warning in the docs if its not fixable due to patching sveltekit's fetch at the moment.

Metadata

Metadata

Assignees

Labels

Package: sveltekitIssues related to the Sentry SvelteKit SDK

Type

No type

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions