diff --git a/web/core/store/pages/project-page.ts b/web/core/store/pages/project-page.ts index 5583e35ef8..a50086a227 100644 --- a/web/core/store/pages/project-page.ts +++ b/web/core/store/pages/project-page.ts @@ -228,20 +228,4 @@ export class ProjectPage extends BasePage implements TProjectPage { throw error; } }; - - getOrFetchPageInstance = async (pageId: string) => { - const pageInstance = this.rootStore.projectPages.getPageById(pageId); - if (pageInstance) { - return pageInstance; - } else { - if (!this.workspace) return; - const workspaceSlug = this.rootStore.workspaceRoot.getWorkspaceById(this.workspace)?.slug; - const projectId = this.project_ids?.[0]; - if (!workspaceSlug || !projectId) return; - const page = await this.rootStore.projectPages.fetchPageDetails(projectId, pageId); - if (page) { - return new ProjectPage(this.rootStore, page); - } - } - }; } diff --git a/web/ee/hooks/use-page-actions-menu.tsx b/web/ee/hooks/use-page-actions-menu.tsx index 9ee2f83269..2c9f86bc96 100644 --- a/web/ee/hooks/use-page-actions-menu.tsx +++ b/web/ee/hooks/use-page-actions-menu.tsx @@ -87,7 +87,7 @@ export const usePageActionsMenu = (props: { // Traverse up the parent chain until we reach the root while (currentPage?.parent_id) { // Get the parent page - currentPage = (await getOrFetchPageInstance(currentPage.parent_id)) as TPageInstance; + currentPage = (await getOrFetchPageInstance({ pageId: currentPage.parent_id })) as TPageInstance; // If we found an archived parent, remember it if (currentPage?.archived_at) { lastArchivedParent = currentPage; diff --git a/web/ee/store/teamspace/pages/teamspace-page.store.ts b/web/ee/store/teamspace/pages/teamspace-page.store.ts index b4c5b0d082..f676acf45b 100644 --- a/web/ee/store/teamspace/pages/teamspace-page.store.ts +++ b/web/ee/store/teamspace/pages/teamspace-page.store.ts @@ -402,7 +402,11 @@ export class TeamspacePageStore implements ITeamspacePageStore { } } }; + removePageInstance = (pageId: string) => { - delete this.data[pageId]; + const page = this.getPageById(pageId); + if (page && page.team) { + delete this.pageMap[page.team][pageId]; + } }; }