app-react: keep nav rest results in sync

Make nav rest results stay live when additional items are taken later in the same render, which lets app nav layouts place specific items after collecting the remaining sidebar entries.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-17 16:20:22 +01:00
parent f7777a6ec8
commit 5f3f5d298b
5 changed files with 162 additions and 28 deletions
+6 -8
View File
@@ -27,15 +27,11 @@ import {
} from '@backstage/core-components';
import SearchIcon from '@material-ui/icons/Search';
import MenuIcon from '@material-ui/icons/Menu';
import BuildIcon from '@material-ui/icons/Build';
import { createFrontendModule } from '@backstage/frontend-plugin-api';
import { NavContentBlueprint } from '@backstage/plugin-app-react';
import { SidebarSearchModal } from '@backstage/plugin-search';
import { NotificationsSidebarItem } from '@backstage/plugin-notifications';
import {
Settings,
UserSettingsSignInAvatar,
} from '@backstage/plugin-user-settings';
import { UserSettingsSignInAvatar } from '@backstage/plugin-user-settings';
import { makeStyles } from '@material-ui/core/styles';
const useSidebarLogoStyles = makeStyles({
@@ -111,7 +107,9 @@ export const appModuleNav = createFrontendModule({
text={item.title}
/>
));
nav.take('page:home'); // Skip home
// Skip these
nav.take('page:home');
nav.take('page:search');
return (
<Sidebar>
<SidebarLogo />
@@ -136,8 +134,8 @@ export const appModuleNav = createFrontendModule({
to="/settings"
>
<NotificationsSidebarItem />
<SidebarItem icon={BuildIcon} to="devtools" text="DevTools" />
<Settings />
{nav.take('page:devtools')}
{nav.take('page:user-settings')}
</SidebarGroup>
</Sidebar>
);