Skip to content

chore(rrweb-player): Migrate to Svelte 5 and bump deps to resolve security alerts#280

Merged
chargome merged 8 commits intosentry-v2from
cg/bump-svelte
Apr 15, 2026
Merged

chore(rrweb-player): Migrate to Svelte 5 and bump deps to resolve security alerts#280
chargome merged 8 commits intosentry-v2from
cg/bump-svelte

Conversation

@chargome
Copy link
Copy Markdown
Member

  • Migrate rrweb-player from Svelte 4 to Svelte 5 ($props, $derived, $effect, $state, callback props)

    • Use asClassComponent from svelte/legacy to preserve the new Player({ target, props }) constructor API — no changes needed downstream in Sentry
    • Bump @sveltejs/vite-plugin-svelte ^3 → ^6, svelte ^4 → ^5, vite ^5 → ^6, svelte-check ^3 → ^4, eslint-plugin-svelte ^2 → ^3
    • Remove unused @sveltejs/kit, @sveltejs/adapter-auto, svelte-preprocess

    Security alerts resolved

@chargome chargome self-assigned this Apr 14, 2026
@chargome chargome marked this pull request as ready for review April 14, 2026 13:09
Comment thread packages/rrweb-player/src/Player.svelte
Comment thread packages/rrweb-player/src/Player.svelte
Comment thread packages/rrweb-player/src/Controller.svelte
Comment thread package.json Outdated
chargome and others added 2 commits April 14, 2026 15:39
…all packages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Preserves the original API contract where addEventListener handlers
receive { payload: value } rather than the unwrapped value.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/rrweb-player/src/Player.svelte
$derived is lazy in Svelte 5 and only evaluates when read. Since
percentage is only used inside {#if showController}, the progress
callback would stop firing when the controller is hidden. Move it
to a separate $effect to preserve the original eager behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/rrweb-player/src/Player.svelte
Comment thread packages/rrweb-player/src/Player.svelte
In Svelte 4, $$props included all props so skipInactive was spread
into the Replayer constructor. With $props() rest, it was excluded.
This caused a race where autoPlay started before the $effect synced
skipInactive to the Replayer config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/rrweb-player/src/Player.svelte
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e63110c. Configure here.

Comment thread packages/rrweb-player/vite.config.ts
onceStylesheetLoaded returned early when link.sheet threw a
SecurityError for CORS stylesheets, preventing the load listener
from being attached and the _cssText mutation from being emitted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/rrweb-player/src/Controller.svelte
Copy link
Copy Markdown
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see some runes :)

onMount(() => {
playerState = replayer.service.state.value;
speedState = replayer.speedService.state.value;
playerState = replayer.service.state.value as typeof playerState;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: why do we need the type casts here (and below)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cast narrows string down to the expected union type.

// for more information about preprocessors
preprocess: vitePreprocess(),

kit: {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this just a leftover? Didn't know we were using kit (?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this just came from scaffolding the proj, so basically a leftover yes

@chargome chargome merged commit 6a1a2d3 into sentry-v2 Apr 15, 2026
21 checks passed
@chargome chargome deleted the cg/bump-svelte branch April 15, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants