Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-591] fix: navigating to a page through Cmd K throws error #3827

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions web/hooks/store/use-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export const usePage = (pageId: string) => {
const { projectPageMap, projectArchivedPageMap } = context.projectPages;

const { projectId, workspaceSlug } = context.app.router;
if (!projectId || !workspaceSlug) throw new Error("usePage must be used within ProjectProvider");

if (projectPageMap[projectId] && projectPageMap[projectId][pageId]) {
return projectPageMap[projectId][pageId];
} else if (projectArchivedPageMap[projectId] && projectArchivedPageMap[projectId][pageId]) {
return projectArchivedPageMap[projectId][pageId];
} else {
if (!projectId || !workspaceSlug) {
console.log("usePage must be used within ProjectProvider");
return;
}

if (projectPageMap[projectId] && projectPageMap[projectId][pageId]) return projectPageMap[projectId][pageId];
else if (projectArchivedPageMap[projectId] && projectArchivedPageMap[projectId][pageId])
return projectArchivedPageMap[projectId][pageId];
else return;
};
Loading