diff --git a/webapp/src/pages/boardPage.tsx b/webapp/src/pages/boardPage.tsx index 3f270b34f..c74b648ba 100644 --- a/webapp/src/pages/boardPage.tsx +++ b/webapp/src/pages/boardPage.tsx @@ -33,8 +33,20 @@ class BoardPage extends React.Component { constructor(props: Props) { super(props) const queryString = new URLSearchParams(window.location.search) - const boardId = queryString.get('id') || '' - const viewId = queryString.get('v') || '' + let boardId = queryString.get('id') || '' + let viewId = queryString.get('v') || '' + + if (!boardId) { + // Load last viewed boardView + boardId = localStorage.getItem('lastBoardId') || '' + viewId = localStorage.getItem('lastViewId') || '' + if (boardId) { + Utils.replaceUrlQueryParam('id', boardId) + } + if (viewId) { + Utils.replaceUrlQueryParam('v', viewId) + } + } this.state = { boardId, @@ -166,6 +178,9 @@ class BoardPage extends React.Component { private async attachToBoard(boardId?: string, viewId = '') { Utils.log(`attachToBoard: ${boardId}`) + localStorage.setItem('lastBoardId', boardId || '') + localStorage.setItem('lastViewId', viewId) + if (boardId) { this.sync(boardId, viewId) } else { @@ -290,6 +305,8 @@ class BoardPage extends React.Component { } showView(viewId: string, boardId: string = this.state.boardId): void { + localStorage.setItem('lastViewId', viewId) + if (this.state.boardTree && this.state.boardId === boardId) { const newBoardTree = this.state.boardTree.copyWithView(viewId) this.setState({boardTree: newBoardTree, viewId})