diff --git a/frontend/src/app/context-switcher.tsx b/frontend/src/app/context-switcher.tsx
index 96b6fdaec0..b73644e62a 100644
--- a/frontend/src/app/context-switcher.tsx
+++ b/frontend/src/app/context-switcher.tsx
@@ -27,48 +27,45 @@ import { SafeHover } from "@/components/safe-hover";
import { VisibilitySensor } from "@/components/visibility-sensor";
export function ContextSwitcher() {
- const [isOpen, setIsOpen] = useState(false);
+ const match = useContextSwitcherMatch();
+
+ if (!match) {
+ return null;
+ }
- const match = useContextSwitchMatch();
+ return ;
+}
+function ContextSwitcherInner({ organization }: { organization: string }) {
+ const [isOpen, setIsOpen] = useState(false);
usePrefetchInfiniteQuery({
- enabled: typeof match === "object" && "organization" in match,
...useCloudDataProvider().projectsQueryOptions({
- organization:
- typeof match === "object" && "organization" in match
- ? match.organization
- : "",
+ organization,
}),
});
- if (!match) {
- return null;
- }
-
return (
- <>
-
-
- }
- >
-
-
-
-
+
+ }
>
- setIsOpen(false)} />
-
-
- >
+
+
+
+
+ setIsOpen(false)} />
+
+
);
}
-const useContextSwitchMatch = ():
+const useContextSwitcherMatch = ():
| {
project: string;
namespace: string;
@@ -100,7 +97,7 @@ const useContextSwitchMatch = ():
};
function Breadcrumbs() {
- const match = useContextSwitchMatch();
+ const match = useContextSwitcherMatch();
if (match && "project" in match && "namespace" in match) {
return (