Skip to content

Persist the card status filter (Open/Completed/Both) in localStorage - #8833

Closed
Dexxes wants to merge 1 commit into
nextcloud:mainfrom
Dexxes:feat/persist-board-filter
Closed

Dexxes wants to merge 1 commit into
nextcloud:mainfrom
Dexxes:feat/persist-board-filter

Conversation

@Dexxes

@Dexxes Dexxes commented Nov 30, 2026

Copy link
Copy Markdown

Summary

  • filter.completed (the "Filter by status" choice in the board's card filter popover) was only ever held in volatile Pinia/Vue state. Every time a board was opened or switched to, two separate code paths reset it back to the default 'both' ("Open and completed"):
    • Controls.vue's watch: { 'board.id': ... } called clearFilter()
    • stores/board.js's loadBoardById() reassigned this.filter to the default object
      So a user choosing "Open" would see it revert the next time they opened the board, even in the same session, let alone after a reload.
  • viewMode already solves the equivalent problem for Kanban/Gantt view by persisting it in localStorage per board (deck.viewMode.${boardId}). This PR applies the same pattern to the whole filter object (tags, users, due, unassigned, completed), keyed by board id as deck.filter.${boardId}.

Changes

  • src/stores/board.js
    • Added DEFAULT_FILTER, filterStorageKey(boardId) and loadStoredFilter(boardId) helpers.
    • loadBoardById() now restores the filter from localStorage (falling back to the default) instead of always resetting to the default.
    • setFilterInStore() now writes the merged filter back to localStorage for the current board whenever it changes.
  • src/components/Controls.vue
    • Mapped the store's filter as storeFilter.
    • The board.id watcher now copies storeFilter into the component's local filter copy (immediate: true, so it also runs on initial mount) instead of calling clearFilter(), which used to force the default on every board switch.

clearFilter() itself is unchanged, so explicitly clearing the filter still works as before - it now also persists "cleared" as the new remembered state for that board, consistent with every other filter change.

Why per board, not global

A "status" filter is a per-board preference, the same way viewMode is - some boards are used read-only/review-style ("show me only what's left"), others benefit from seeing everything. Scoping the storage key by board id keeps that distinction, exactly like viewMode already does.

Test plan

  • On a board, open the filter popover, pick "Open" under "Filter by status".
  • Reload the page / navigate away and back to the board -> "Open" should still be selected and only open cards shown.
  • Switch to a different board -> that board's own remembered filter (or the default, if never set) should apply, not the first board's.
  • "Clear filter" still resets tags/users/due/status to defaults for the current board.
  • I was not able to run Deck's own lint/test suite locally (no Node.js available in that environment) - please let CI run npm run lint / the existing test suite before merging.

Transparency note:
This PR was co-created with Claude Code

…alStorage

filter.completed, picked in the board's "Filter by status" popover, was
only ever held in volatile Pinia state. Both Controls.vue's board.id
watcher (clearFilter()) and board.js's loadBoardById() reset it back
to the default 'both' every time a board was opened, so a user's
"Open" choice never survived a reload or a board switch.

viewMode already solves the same problem for the Kanban/Gantt toggle
via localStorage, keyed per board (deck.viewMode.${boardId}). Apply
the same pattern to the whole filter object, keyed as
deck.filter.${boardId}, and load/save it in loadBoardById() /
setFilterInStore() instead of hard-resetting on every board switch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Dexxes Dexxes closed this by deleting the head repository Nov 30, 2026
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