Skip to content
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
23 changes: 16 additions & 7 deletions packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,24 @@ function PackageSwitcher({ packageId, tab }: { packageId: string; tab: string })

React.useEffect(() => {
let cancelled = false;
fetchPackages()
.then((parsed) => {
if (!cancelled) setPkgs(parsed);
})
.catch(() => {
/* leave null — switcher still works for navigation-free display */
});
const load = () => {
fetchPackages()
.then((parsed) => {
if (!cancelled) setPkgs(parsed);
})
.catch(() => {
/* leave null — switcher still works for navigation-free display */
});
};
load();
// Refresh the switcher list (and thus the top-bar package name) when a
// package is created or its manifest is edited elsewhere — PackageFormDialog
// dispatches `objectui:packages-changed` on create/edit. Without this the
// header showed the OLD name after a rename until a full page reload.
window.addEventListener('objectui:packages-changed', load);
return () => {
cancelled = true;
window.removeEventListener('objectui:packages-changed', load);
};
}, [packageId]);

Expand Down
Loading