Skip to content

refactor: replace lz-string with native CompressionStream API#40

Merged
magnus-madsen merged 1 commit intomasterfrom
refactor/replace-lzstring-with-compression-stream
Mar 12, 2026
Merged

refactor: replace lz-string with native CompressionStream API#40
magnus-madsen merged 1 commit intomasterfrom
refactor/replace-lzstring-with-compression-stream

Conversation

@magnus-madsen
Copy link
Member

@magnus-madsen magnus-madsen commented Mar 12, 2026

Summary

  • Replace the lz-string library with the browser-native CompressionStream/DecompressionStream API (DEFLATE-raw + base64url encoding), removing the dependency entirely
  • Move compression from every-keystroke to on-demand when "Shareable Link" is clicked (async)
  • Clear the ?q= query param from the URL when the user edits code or selects a sample from the dropdown

Test plan

  • npm run build succeeds with no lz-string references
  • Load app with no query param — default program loads
  • Edit code or select a dropdown example — ?q= is removed from URL if present
  • Click "Shareable Link" — URL updates with compressed ?q= param
  • Copy that URL and open in a new tab — program loads correctly
  • Confirm lz-string is gone from package.json and node_modules

Note: Existing shared URLs using the old lz-string format will no longer decode. If backwards compatibility is needed, a fallback decoder can be added.

🤖 Generated with Claude Code

Use the browser's built-in CompressionStream/DecompressionStream with
DEFLATE-raw instead of the lz-string library. Compression now only
happens on "Shareable Link" click (async) rather than on every keystroke.
The ?q= param is cleared from the URL when the user edits code or
selects an example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@magnus-madsen magnus-madsen merged commit 76785f3 into master Mar 12, 2026
2 checks passed
@magnus-madsen magnus-madsen deleted the refactor/replace-lzstring-with-compression-stream branch March 12, 2026 15:10
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.

1 participant