Skip to content

fix: make vite example channel selection bookmarkable#2997

Merged
oliverlaz merged 5 commits intomasterfrom
fix/vite-bookmarkable-channel
Mar 11, 2026
Merged

fix: make vite example channel selection bookmarkable#2997
oliverlaz merged 5 commits intomasterfrom
fix/vite-bookmarkable-channel

Conversation

@oliverlaz
Copy link
Member

@oliverlaz oliverlaz commented Mar 10, 2026

🎯 Goal

Make the Vite example state bookmarkable and shareable by syncing the active channel, the selected main view, and the selected thread with the URL.

🛠 Implementation details

  • Read a channel query param in the Vite example and pass it to ChannelList.customActiveChannel.
  • Read a view query param and restore the selected main view on load, supporting view=chat and view=threads.
  • Read a thread query param and restore the selected thread when the threads view mounts.
  • Sync the active channel, the active view, and the active thread back into the URL with history.replaceState while preserving existing params like token and user_id.
  • Prefer the thread object already present in the thread list so the restored thread also stays selected in the list UI.
  • Fall back to the first channel when customActiveChannel is missing or invalid.
  • Add coverage for the customActiveChannel fallback behavior.
  • Add the shared matchMedia Jest polyfill and missing React imports needed for the exercised test path.

🎨 UI Changes

N/A. This changes URL state only.

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Size Change: +1 B (0%)

Total Size: 428 kB

Filename Size Change
./dist/cjs/index.js 213 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/audioProcessing-BbOs2wMd.js 1.32 kB
./dist/Channel-iBbX1_YS.js 20.2 kB
./dist/ChannelPreview-7kWxXGw8.js 13.8 kB
./dist/cjs/emojis.js 2.97 kB
./dist/cjs/experimental.js 3.81 kB
./dist/cjs/mp3-encoder.js 1.27 kB
./dist/css/index.css 41.5 kB
./dist/css/v2/emoji-mart.css 1.84 kB
./dist/css/v2/emoji-replacement.css 300 B
./dist/css/v2/index.css 39.4 kB
./dist/css/v2/index.layout.css 22.8 kB
./dist/limits-CxyAOSJp.js 65.2 kB

compressed-size-action

@oliverlaz oliverlaz merged commit 1fbbfd1 into master Mar 11, 2026
5 of 6 checks passed
@oliverlaz oliverlaz deleted the fix/vite-bookmarkable-channel branch March 11, 2026 09:02
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