From e988812ccb8cab762adcb948bfd10bb3e6700b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 16 Jul 2021 12:46:27 +0200 Subject: [PATCH] Removing the forceRefresh from the router (#732) * Removing the forceRefresh from the router * Fix eslint --- webapp/src/app.tsx | 5 +---- webapp/src/octoListener.ts | 6 +++++- webapp/src/pages/boardPage.tsx | 9 +++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/webapp/src/app.tsx b/webapp/src/app.tsx index 3aa05c362..acbb0e50b 100644 --- a/webapp/src/app.tsx +++ b/webapp/src/app.tsx @@ -49,10 +49,7 @@ const App = React.memo((): JSX.Element => { > - +
diff --git a/webapp/src/octoListener.ts b/webapp/src/octoListener.ts index 3628e2987..8da5a6dd8 100644 --- a/webapp/src/octoListener.ts +++ b/webapp/src/octoListener.ts @@ -138,7 +138,11 @@ class OctoListener { this.blockIds = [] this.onChange = undefined this.isInitialized = false - ws.close() + try { + ws?.close() + } catch { + Utils.log('OctoListener unable to close the websocket') + } } private authenticate(workspaceId: string): void { diff --git a/webapp/src/pages/boardPage.tsx b/webapp/src/pages/boardPage.tsx index 0e80322f7..922c316eb 100644 --- a/webapp/src/pages/boardPage.tsx +++ b/webapp/src/pages/boardPage.tsx @@ -81,6 +81,15 @@ class BoardPage extends React.Component { const board = this.state.boardTree?.board const prevBoard = prevState.boardTree?.board + const boardId = this.props.match.params.boardId + const prevBoardId = prevProps.match.params.boardId + const viewId = this.props.match.params.viewId + const prevViewId = prevProps.match.params.viewId + + if (boardId && (boardId !== prevBoardId || viewId !== prevViewId)) { + this.attachToBoard(boardId, viewId) + } + const activeView = this.state.boardTree?.activeView const prevActiveView = prevState.boardTree?.activeView