feat: Remember which view a board was last put into

Choosing a view and finding the board's default again after every reload is
the board forgetting something the reader clearly meant.

The choice lives in `sessionStorage`, not on the account. A view is how one
person is looking at a board right now, not a property of the board: two
windows may hold the same board open as a grid and as a list, and neither is
wrong. A stored preference would make one of them change under the other's
hands.

The context is stored alongside and has to match on the way back out, so a
view picked in the archive does not follow the board into its own context. A
view this build no longer knows falls through to the board's default, as does
anything stored while the browser refuses to keep it.
This commit is contained in:
Daniel Hiller
2026-09-17 00:42:11 +02:00
parent 764bd106a7
commit 2030722242
4 changed files with 87 additions and 1 deletions
+5 -1
View File
@@ -8,6 +8,7 @@ import { attr, fk, many } from 'redux-orm';
import BaseModel from './BaseModel';
import buildSearchParts from '../utils/build-search-parts';
import { isListKanban } from '../utils/record-helpers';
import { recallBoardView } from '../utils/board-view-memory';
import ActionTypes from '../constants/ActionTypes';
import Config from '../constants/Config';
import { BoardContexts, BoardViews } from '../constants/Enums';
@@ -16,7 +17,10 @@ const prepareFetchedBoard = (board) => ({
...board,
isFetching: false,
context: BoardContexts.BOARD,
view: board.defaultView,
// Whatever this window was last looking at, where that choice still applies —
// see `utils/board-view-memory`. A board's configured default is where it
// starts, not where it has to stay.
view: recallBoardView(board.id, BoardContexts.BOARD) || board.defaultView,
search: '',
});