Skip to content

Open source CapCut alternative.

TypeScript

feat(site): the tab wears the open project's name

David Le5d1f839571e1
diff --git a/site/src/cut/components/Editor.tsx b/site/src/cut/components/Editor.tsx
index 038ea082..d2833cb9 100644
--- a/site/src/cut/components/Editor.tsx
+++ b/site/src/cut/components/Editor.tsx
@@ -88,6 +88,17 @@ export function Editor({
const back = backTarget(useCutBase(), from, folder);
const loaded = useEditor((s) => s.loaded);
const loadError = useEditor((s) => s.loadError);
+ // The tab is the open project, so it wears the project's name — through
+ // renames too. Leaving hands the title back to whatever it was.
+ const projectName = useEditor((s) => s.projectName);
+ useEffect(() => {
+ if (!projectName) return;
+ const previous = document.title;
+ document.title = projectName;
+ return () => {
+ document.title = previous;
+ };
+ }, [projectName]);
// Until loadProject runs, the store still holds the previously open project;
// rendering the editor against it would leak that project's state (chat,
// clips, selection) into this route.