Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: initial fetch filters is not being applied when we have a undefined currentTab in params (#5288)

guru_sainath79fbcaa2b2f3
diff --git a/web/core/components/inbox/root.tsx b/web/core/components/inbox/root.tsx
index 5913f69fce..5d5617bb39 100644
--- a/web/core/components/inbox/root.tsx
+++ b/web/core/components/inbox/root.tsx
@@ -34,7 +34,12 @@ export const InboxIssueRoot: FC<TInboxIssueRoot> = observer((props) => {
if (navigationTab && navigationTab !== currentTab) {
handleCurrentTab(workspaceSlug, projectId, navigationTab);
} else {
- fetchInboxIssues(workspaceSlug.toString(), projectId.toString(), undefined, navigationTab);
+ fetchInboxIssues(
+ workspaceSlug.toString(),
+ projectId.toString(),
+ undefined,
+ navigationTab || EInboxIssueCurrentTab.OPEN
+ );
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [inboxAccessible, workspaceSlug, projectId]);
@@ -77,6 +82,7 @@ export const InboxIssueRoot: FC<TInboxIssueRoot> = observer((props) => {
setIsMobileSidebar={setIsMobileSidebar}
workspaceSlug={workspaceSlug.toString()}
projectId={projectId.toString()}
+ inboxIssueId={inboxIssueId}
/>
</div>
diff --git a/web/core/components/inbox/sidebar/root.tsx b/web/core/components/inbox/sidebar/root.tsx
index 2ee8552431..58f49a46cf 100644
--- a/web/core/components/inbox/sidebar/root.tsx
+++ b/web/core/components/inbox/sidebar/root.tsx
@@ -2,7 +2,6 @@
import { FC, useCallback, useEffect, useRef, useState } from "react";
import { observer } from "mobx-react";
-import { useParams } from "next/navigation";
import { TInboxIssueCurrentTab } from "@plane/types";
import { Loader } from "@plane/ui";
// components
@@ -22,6 +21,7 @@ import { useIntersectionObserver } from "@/hooks/use-intersection-observer";
type IInboxSidebarProps = {
workspaceSlug: string;
projectId: string;
+ inboxIssueId: string | undefined;
setIsMobileSidebar: (value: boolean) => void;
};
@@ -37,7 +37,7 @@ const tabNavigationOptions: { key: TInboxIssueCurrentTab; label: string }[] = [
];
export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
- const { workspaceSlug, projectId, setIsMobileSidebar } = props;
+ const { workspaceSlug, projectId, inboxIssueId, setIsMobileSidebar } = props;
// ref
const containerRef = useRef<HTMLDivElement>(null);
const [elementRef, setElementRef] = useState<HTMLDivElement | null>(null);
@@ -54,7 +54,6 @@ export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
} = useProjectInbox();
const router = useAppRouter();
- const { inboxIssueId } = useParams();
const fetchNextPages = useCallback(() => {
if (!workspaceSlug || !projectId) return;
@@ -65,11 +64,14 @@ export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
useIntersectionObserver(containerRef, elementRef, fetchNextPages, "20%");
useEffect(() => {
- if (inboxIssueId) return;
- router.push(
- `/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${currentTab}&inboxIssueId=${filteredInboxIssueIds[0]}`
- );
- }, []);
+ if (workspaceSlug && projectId && currentTab && filteredInboxIssueIds.length > 0) {
+ if (inboxIssueId === undefined) {
+ router.push(
+ `/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${currentTab}&inboxIssueId=${filteredInboxIssueIds[0]}`
+ );
+ }
+ }
+ }, [currentTab, filteredInboxIssueIds, inboxIssueId, projectId, router, workspaceSlug]);
return (
<div className="bg-custom-background-100 flex-shrink-0 w-full h-full border-r border-custom-border-300 ">