Skip to content

Open source CapCut alternative.

TypeScript

fix(site): the new-project dialog closes before the editor opens

David Lec5c708746c0c
diff --git a/docs/guides/frontend-nextjs-guidelines.md b/docs/guides/frontend-nextjs-guidelines.md
index 39552c5f..ac79b421 100644
--- a/docs/guides/frontend-nextjs-guidelines.md
+++ b/docs/guides/frontend-nextjs-guidelines.md
@@ -68,6 +68,8 @@ away and back. Effects are torn down on the way out and re-run on the way back,
so anything holding a real resource — a decoder, an audio graph, a timer —
releases it in an effect cleanup, and anything transient that should not come
back open, like a dropdown, closes in a `useLayoutEffect` cleanup.
+A document-wide DOM query sees those hidden pages too, portals included, so a
+scan that asks whether something is on screen checks `checkVisibility()`.
## Navigation
diff --git a/site/src/cut/components/AppSidebar.tsx b/site/src/cut/components/AppSidebar.tsx
index 99985b49..30e063ef 100644
--- a/site/src/cut/components/AppSidebar.tsx
+++ b/site/src/cut/components/AppSidebar.tsx
@@ -65,6 +65,10 @@ export function AppSidebar() {
// needs no round trip to draw it.
seedNewProjectDoc(project.id, project.name, r);
track("project_created", { source: "sidebar" });
+ // The dialog closes here, before the editor opens: the page it sits on
+ // stays mounted behind the editor, and a dialog left open on it would
+ // still be open on the way back.
+ setCreateIn(null);
// The link carries no residency; the editor resolves it by asking which
// backend owns the id, so a cloud project created from a Mac still opens
// against the cloud.
diff --git a/site/src/cut/components/ProjectsHome.tsx b/site/src/cut/components/ProjectsHome.tsx
index 23d975c1..d61bdd31 100644
--- a/site/src/cut/components/ProjectsHome.tsx
+++ b/site/src/cut/components/ProjectsHome.tsx
@@ -444,6 +444,10 @@ export function ProjectsHome() {
patch(r, (s) => ({ ...s, projects: [project, ...s.projects] }));
seedNewProjectDoc(project.id, project.name, r, aspect);
track("project_created", { source: "projects_home" });
+ // The dialog closes here, before the editor opens: the page it sits on
+ // stays mounted behind the editor, and a dialog left open on it would
+ // still be open on the way back.
+ setCreateIn(null);
router.push(projectHref(base, project.id, "projects", folderId));
};