block / block/buzz

fix(mobile): channel section folders bleed across linked workspaces

Open
#5,762 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

## Summary

On mobile, custom channel folders (sections) such as `production` / `estimates` created in one community remain visible after switching to a different linked workspace (e.g. Coker Construction → Lit Box), even when none of that community's channels exist there. Folders appear **empty** on the other workspace.

Desktop does **not** have this problem: #1477 scoped channel sections local storage to **pubkey + relay URL**. Mobile never received that port and still keys prefs account-globally.

## Environment

- Client: **Buzz mobile**
- Surfaces: channel list / sidebar sections
- Repro path: multiple communities linked on one account, switch between them

## Steps to reproduce

1. In community A (e.g. Coker Construction), create custom sections (e.g. `production`, `estimates`) and assign channels into them.
2. Link / switch to community B (e.g. Lit Box) on the same account.
3. Observe the channel list on B.

## Expected

Section folders are **per workspace/relay** (Desktop behavior after #1477). Community B only shows sections created for B.

## Actual

Section names from A appear on B, empty of channels. Layout is account-global on mobile.

## Root cause (code)

| Client | Local storage key |
|--------|-------------------|
| Desktop | `buzz-channel-sections.v1:$pubkey:$normalizedRelay` (#1477) |
| Mobile (before fix) | `buzz.channel-sections.v1:$pubkey` only |

Mobile also always renders every section even when zero channels resolve on the active relay.

Same intentional pattern already used on mobile for **channel-sort** (`channel_sort_storage.dart`).

## Fix

PR: https://github.com/block/buzz/pull/5761

- Scope mobile channel-sections SharedPreferences by pubkey + normalized relay URL
- One-time migration: first active relay after upgrade claims the legacy unscoped blob, then deletes the legacy key so later communities stay clean
- Provider remounts on active community change

## Related

- Desktop fix: #1477 `fix(sidebar): scope channel sections storage to relay URL`
- Adjacent (not this bug): #4883 section sync mobile ↔ desktop; #5469 shared team section layouts

## Release notes draft

> **Mobile:** Custom channel folders no longer leak empty across linked workspaces. Folders are now per community, matching Desktop.

## Verification

- [x] Unit/storage tests on PR #5761 (15/15 channel_sections suite)
- [ ] Manual: create folders on A, switch to B → A folders absent on B
- [ ] Manual: after upgrade, open original community first if you need legacy folders preserved there

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.