From d3a9a764dccaf428f784d08259c4ffc454366c3a Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Mon, 4 Sep 2023 01:50:49 +0530 Subject: [PATCH] fix: space redirections (#2069) --- .../issues/board-views/kanban/block.tsx | 5 ++--- .../issues/board-views/list/block.tsx | 4 ++-- space/components/issues/navbar/index.tsx | 18 +++++++++++------- .../issues/navbar/issue-board-view.tsx | 16 +--------------- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/space/components/issues/board-views/kanban/block.tsx b/space/components/issues/board-views/kanban/block.tsx index 40f6576be..b4de76f2b 100644 --- a/space/components/issues/board-views/kanban/block.tsx +++ b/space/components/issues/board-views/kanban/block.tsx @@ -23,8 +23,7 @@ export const IssueListBlock = observer(({ issue }: { issue: IIssue }) => { const handleBlockClick = () => { issueDetailStore.setPeekId(issue.id); - router.replace( - `/[workspace_slug]/[project_slug]`, + router.push( { pathname: `/${workspace_slug?.toString()}/${project_slug}`, query: { @@ -32,9 +31,9 @@ export const IssueListBlock = observer(({ issue }: { issue: IIssue }) => { peekId: issue.id, }, }, + undefined, { shallow: true } ); - // router.push(`/${workspace_slug?.toString()}/${project_slug}?board=${board?.toString()}&peekId=${issue.id}`); }; return ( diff --git a/space/components/issues/board-views/list/block.tsx b/space/components/issues/board-views/list/block.tsx index 067d4693a..2d1cdf9ba 100644 --- a/space/components/issues/board-views/list/block.tsx +++ b/space/components/issues/board-views/list/block.tsx @@ -26,8 +26,7 @@ export const IssueListBlock: FC<{ issue: IIssue }> = observer((props) => { const handleBlockClick = () => { issueDetailStore.setPeekId(issue.id); - router.replace( - `/[workspace_slug]/[project_slug]`, + router.push( { pathname: `/${workspace_slug?.toString()}/${project_slug}`, query: { @@ -35,6 +34,7 @@ export const IssueListBlock: FC<{ issue: IIssue }> = observer((props) => { peekId: issue.id, }, }, + undefined, { shallow: true } ); // router.push(`/${workspace_slug?.toString()}/${project_slug}?board=${board?.toString()}&peekId=${issue.id}`); diff --git a/space/components/issues/navbar/index.tsx b/space/components/issues/navbar/index.tsx index c9d0f52d1..509d676b7 100644 --- a/space/components/issues/navbar/index.tsx +++ b/space/components/issues/navbar/index.tsx @@ -44,15 +44,19 @@ const IssueNavbar = observer(() => { }, [projectStore, workspace_slug, project_slug]); useEffect(() => { - if (workspace_slug && projectStore) { - if (board) { - projectStore.setActiveBoard(board.toString()); - } else { - router.push(`/${workspace_slug}/${project_slug}?board=list`); - projectStore.setActiveBoard("list"); + if (workspace_slug && project_slug) { + if (!board) { + router.push({ + pathname: `/${workspace_slug}/${project_slug}`, + query: { + board: "list", + }, + }); + return projectStore.setActiveBoard("list"); } + projectStore.setActiveBoard(board.toString()); } - }, [board, router, projectStore, workspace_slug, project_slug]); + }, [board, workspace_slug, project_slug]); return (
diff --git a/space/components/issues/navbar/issue-board-view.tsx b/space/components/issues/navbar/issue-board-view.tsx index 62f4d1702..0ae71e8ee 100644 --- a/space/components/issues/navbar/issue-board-view.tsx +++ b/space/components/issues/navbar/issue-board-view.tsx @@ -14,21 +14,7 @@ export const NavbarIssueBoardView = observer(() => { const handleCurrentBoardView = (boardView: string) => { projectStore.setActiveBoard(boardView); - router.push( - `/${workspace_slug}/${project_slug}?board=${boardView}${ - issueStore?.filteredLabels && issueStore?.filteredLabels.length > 0 - ? `&labels=${issueStore?.filteredLabels.join(",")}` - : "" - }${ - issueStore?.filteredPriorities && issueStore?.filteredPriorities.length > 0 - ? `&priorities=${issueStore?.filteredPriorities.join(",")}` - : "" - }${ - issueStore?.filteredStates && issueStore?.filteredStates.length > 0 - ? `&states=${issueStore?.filteredStates.join(",")}` - : "" - }` - ); + router.push(`/${workspace_slug}/${project_slug}?board=${boardView}`); }; return (