fix(desktop): keep channel-sections scoped to the active community - #7241
Open
changsheng1224 wants to merge 1 commit into
Open
fix(desktop): keep channel-sections scoped to the active community#7241changsheng1224 wants to merge 1 commit into
changsheng1224 wants to merge 1 commit into
Conversation
Fence writers by community scope, filter foreign assignments before persist/publish, defer seed until channels are ready, and heal polluted local blobs so a workspace switch cannot write B's layout into A's kind:30078 channel-sections event. Fixes block#7207 Signed-off-by: changsheng1224 <152450618+changsheng1224@users.noreply.github.com>
🔐 Codex Security Review
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Desktop persists and publishes the channel-sections layout of the
previously active community into the newly active community after a
workspace switch. Community A's
kind:30078d=channel-sectionsevent (andthe matching localStorage key) can end up with channel UUIDs and section
objects that exist only on community B.
This is a persistence/publish bug, not only a render bug: the wrong assignment
map is written to the other community's relay, so it survives restarts and
follows the user to a new machine.
Cause
Section state is keyed
…:<pubkey>:<relayUrl>, but in-memory writers andfirst-sync seed-publish were not reliably fenced to the active community
before channels were ready. A stale store (or a polluted local blob) could be
persisted/published under the new relay URL, including while the channel
allowlist was still empty and filtering was a no-op.
Fix
writers cannot land under the new
relayUrl.localStorage write and
kind:30078publish; drop section folders that onlyheld foreign-channel assignments.
(
channelsReady), then heal already-polluted local state and republish thecleaned blob.
cannot resurrect the symptom.
Related
workspaces).
fix(sidebar): converge channel sidebar state across devices), which rewrites the same hook for multi-deviceLWW/outbox convergence but does not close the cross-community channel-id
leak. This PR is intentionally narrower and landable on current
main; iffix(sidebar): converge channel sidebar state across devices #6525 merges first, this will need a rebase.
Testing
pnpm exec node --import ./test-loader.mjs --experimental-strip-types --teston:
desktop/src/features/sidebar/lib/channelSectionsHelpers.test.mjsdesktop/src/features/sidebar/lib/useChannelSections.test.mjsdesktop/src/features/sidebar/lib/channelSectionsSync.test.mjsdesktop/src/features/sidebar/lib/channelSectionsStorage.test.mjs(58 passed)
origin/mainuseChannelSections.tsand pass with this changepnpm exec playwright test --project=smoke tests/e2e/community-rail.spec.ts -g 7207(1 passed — organize on B, switch to A, assert A's store and post-switch
sign_eventpayloads carry no B section layout)