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:
@@ -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: '',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user