Skip to content

fix(desktop): remember Inbox Show unread only - #6105

Open
Trevongit wants to merge 1 commit into
block:mainfrom
Trevongit:feat/inbox-unread-only-persist
Open

fix(desktop): remember Inbox Show unread only#6105
Trevongit wants to merge 1 commit into
block:mainfrom
Trevongit:feat/inbox-unread-only-persist

Conversation

@Trevongit

Copy link
Copy Markdown

Summary

Inbox Show unread only reset every time you left and came back, because HomeView remounts with useState(false).

Persist the switch in localStorage (buzz.desktop.inbox-unread-only) and read it on mount. An in-memory cache covers the same session if storage is unavailable.

Test

  • Unit: desktop/src/features/home/lib/inboxUnreadOnlyPreference.test.mjs
  • Manual: Inbox → Show unread only on → open a channel → Inbox again. Switch stays on.

Small UX. No protocol change. Take it or leave it.

Leaving Inbox remounts HomeView and used to drop the switch
back to off. Persist it in localStorage so the next visit
keeps the filter.

Signed-off-by: Trevor P <trev2005@gmail.com>
@Trevongit
Trevongit requested a review from a team as a code owner August 17, 2026 07:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e29967089a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


export function readInboxUnreadOnlyPreference(): boolean {
if (memory !== null) return memory;
const raw = storage()?.getItem(INBOX_UNREAD_ONLY_KEY);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make the preference read throw-safe

When WKWebView denies website-data access, retrieving window.localStorage may succeed while getItem throws SecurityError; this call is outside the try and runs in the useState initializer, so opening Home sends the entire app to the root failure splash on every mount. Use the existing getStorageItem helper from desktop/src/shared/lib/safeStorage.ts (or catch the read itself) so this preference falls back to false as intended.

Useful? React with 👍 / 👎.

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