diff --git a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx index 9aa9d11a4..cbd500273 100644 --- a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx +++ b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx @@ -27,7 +27,7 @@ const PageDetailsPage = observer(() => { // fetch page details const { error: pageDetailsError } = useSWR( pageId ? `PAGE_DETAILS_${pageId}` : null, - pageId ? () => getPageById(pageId.toString()) : null, + pageId ? () => getPageById(workspaceSlug?.toString(), projectId?.toString(), pageId.toString()) : null, { revalidateIfStale: false, revalidateOnFocus: false, diff --git a/web/core/components/inbox/root.tsx b/web/core/components/inbox/root.tsx index 759dce50c..ac85c6476 100644 --- a/web/core/components/inbox/root.tsx +++ b/web/core/components/inbox/root.tsx @@ -31,7 +31,7 @@ export const InboxIssueRoot: FC = observer((props) => { useEffect(() => { if (!inboxAccessible || !workspaceSlug || !projectId) return; if (navigationTab && navigationTab !== currentTab) { - handleCurrentTab(navigationTab); + handleCurrentTab(workspaceSlug, projectId, navigationTab); } else { fetchInboxIssues(workspaceSlug.toString(), projectId.toString()); } diff --git a/web/core/components/inbox/sidebar/root.tsx b/web/core/components/inbox/sidebar/root.tsx index 1e2ace4ae..e874d0c4b 100644 --- a/web/core/components/inbox/sidebar/root.tsx +++ b/web/core/components/inbox/sidebar/root.tsx @@ -75,7 +75,7 @@ export const InboxSidebar: FC = observer((props) => { )} onClick={() => { if (currentTab != option?.key) { - handleCurrentTab(option?.key); + handleCurrentTab(workspaceSlug, projectId, option?.key); router.push(`/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${option?.key}`); } }} diff --git a/web/core/components/pages/pages-list-view.tsx b/web/core/components/pages/pages-list-view.tsx index 1cd3ef0c5..abcd06298 100644 --- a/web/core/components/pages/pages-list-view.tsx +++ b/web/core/components/pages/pages-list-view.tsx @@ -18,7 +18,10 @@ export const PagesListView: React.FC = observer((props) => { // store hooks const { isAnyPageAvailable, getAllPages } = useProjectPages(); // fetching pages list - useSWR(projectId ? `PROJECT_PAGES_${projectId}` : null, projectId ? () => getAllPages(pageType) : null); + useSWR( + projectId ? `PROJECT_PAGES_${projectId}` : null, + projectId ? () => getAllPages(workspaceSlug, projectId, pageType) : null + ); // pages loader return ( diff --git a/web/core/hooks/use-auto-save.tsx b/web/core/hooks/use-auto-save.tsx index 120c4d53b..c477fb104 100644 --- a/web/core/hooks/use-auto-save.tsx +++ b/web/core/hooks/use-auto-save.tsx @@ -4,7 +4,7 @@ import { debounce } from "lodash"; const AUTO_SAVE_TIME = 10000; const useAutoSave = (handleSaveDescription: (forceSync?: boolean, yjsAsUpdate?: Uint8Array) => void) => { - const intervalIdRef = useRef(null); + const intervalIdRef = useRef(null); const handleSaveDescriptionRef = useRef(handleSaveDescription); // Update the ref to always point to the latest handleSaveDescription diff --git a/web/core/store/inbox/project-inbox.store.ts b/web/core/store/inbox/project-inbox.store.ts index 73cafcb35..e77ccfcd1 100644 --- a/web/core/store/inbox/project-inbox.store.ts +++ b/web/core/store/inbox/project-inbox.store.ts @@ -54,7 +54,7 @@ export interface IProjectInboxStore { ) => Partial>; createOrUpdateInboxIssue: (inboxIssues: TInboxIssue[], workspaceSlug: string, projectId: string) => void; // actions - handleCurrentTab: (tab: TInboxIssueCurrentTab) => void; + handleCurrentTab: (workspaceSlug: string, projectId: string, tab: TInboxIssueCurrentTab) => void; handleInboxIssueFilters: (key: T, value: TInboxIssueFilter[T]) => void; // if user sends me undefined, I will remove the value from the filter key handleInboxIssueSorting: (key: T, value: TInboxIssueSorting[T]) => void; // if user sends me undefined, I will remove the value from the filter key fetchInboxIssues: (workspaceSlug: string, projectId: string, loadingType?: TLoader) => Promise; @@ -216,7 +216,7 @@ export class ProjectInboxStore implements IProjectInboxStore { }; // actions - handleCurrentTab = (tab: TInboxIssueCurrentTab) => { + handleCurrentTab = (workspaceSlug: string, projectId: string, tab: TInboxIssueCurrentTab) => { runInAction(() => { set(this, "currentTab", tab); set(this, "inboxFilters", undefined); @@ -227,7 +227,6 @@ export class ProjectInboxStore implements IProjectInboxStore { if (tab === "closed") set(this, ["inboxFilters", "status"], [-1, 1, 2]); else set(this, ["inboxFilters", "status"], [-2]); }); - const { workspaceSlug, projectId } = this.store.router; if (workspaceSlug && projectId) this.fetchInboxIssues(workspaceSlug, projectId, "filter-loading"); }; diff --git a/web/core/store/pages/project-page.store.ts b/web/core/store/pages/project-page.store.ts index e78d086cb..26b532320 100644 --- a/web/core/store/pages/project-page.store.ts +++ b/web/core/store/pages/project-page.store.ts @@ -31,8 +31,12 @@ export interface IProjectPageStore { updateFilters: (filterKey: T, filterValue: TPageFilters[T]) => void; clearAllFilters: () => void; // actions - getAllPages: (pageType: TPageNavigationTabs) => Promise; - getPageById: (pageId: string) => Promise; + getAllPages: ( + workspaceSlug: string, + projectId: string, + pageType: TPageNavigationTabs + ) => Promise; + getPageById: (workspaceSlug: string, projectId: string, pageId: string) => Promise; createPage: (pageData: Partial) => Promise; removePage: (pageId: string) => Promise; } @@ -148,9 +152,8 @@ export class ProjectPageStore implements IProjectPageStore { /** * @description fetch all the pages */ - getAllPages = async (pageType: TPageNavigationTabs) => { + getAllPages = async (workspaceSlug: string, projectId: string, pageType: TPageNavigationTabs) => { try { - const { workspaceSlug, projectId } = this.store.router; if (!workspaceSlug || !projectId) return undefined; const currentPageIds = this.getCurrentProjectPageIds(pageType); @@ -182,9 +185,8 @@ export class ProjectPageStore implements IProjectPageStore { * @description fetch the details of a page * @param {string} pageId */ - getPageById = async (pageId: string) => { + getPageById = async (workspaceSlug: string, projectId: string, pageId: string) => { try { - const { workspaceSlug, projectId } = this.store.router; if (!workspaceSlug || !projectId || !pageId) return undefined; const currentPageId = this.pageById(pageId);