fix: build and types (#3270)

* fix: build and types

* fix: teamspace page store
This commit is contained in:
M. Palanikannan
2025-05-26 20:45:54 +05:30
committed by GitHub
parent 3798aa8c6f
commit c2caa46587
3 changed files with 6 additions and 18 deletions

View File

@@ -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);
}
}
};
}

View File

@@ -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;

View File

@@ -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];
}
};
}