Library: 'All pages' link drops the open page and shows the info view
release gate / check (push) Failing after 5m27s
release gate / check (push) Failing after 5m27s
Client-side navigation from /pages?id=X to /pages kept activeId set, so the editor stayed mounted instead of the Library index. Clear the open page (flushing autosave first) when initialId is null.
This commit is contained in:
@@ -175,8 +175,17 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
||||
}
|
||||
|
||||
// The sidebar can create or open pages while this workspace stays mounted.
|
||||
// Navigating to /pages with NO id (the "All pages" info view) must drop the
|
||||
// open page, otherwise a client-side navigation keeps the editor mounted.
|
||||
useEffect(() => {
|
||||
if (!initialId || initialId === activePage.current) return
|
||||
if (!initialId) {
|
||||
const cur = activePage.current
|
||||
const clear = () => { activePage.current = null; setActiveId(null); setPage(null); notifyActivePage(null) }
|
||||
if (cur) void autosave.flush(cur).then(clear)
|
||||
else clear()
|
||||
return
|
||||
}
|
||||
if (initialId === activePage.current) return
|
||||
void loadPages()
|
||||
void select(initialId)
|
||||
}, [initialId])
|
||||
|
||||
Reference in New Issue
Block a user