Skip to content

Commit 656573d

Browse files
committed
fix: buildQueryOptions error (#3132)
Closes FRONT-838 ### TL;DR Hide the "Instances" section in the sidebar when the data provider doesn't support query options. ### What changed? Added a check to verify if the data provider has the `buildsQueryOptions` capability before rendering the "Instances" section in both the Subnav and CloudSidebarContent components. This prevents displaying the Instances section when it's not applicable. ### How to test? 1. Connect to a data provider that doesn't support query options 2. Verify that the "Instances" section is not displayed in the sidebar 3. Connect to a data provider that does support query options 4. Verify that the "Instances" section appears correctly ### Why make this change? Some data providers don't support query options, making the "Instances" section irrelevant for those providers. This change improves the UI by only showing relevant navigation options based on the capabilities of the connected data provider.
1 parent a42d8ca commit 656573d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frontend/src/app/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
Skeleton,
4343
} from "@/components";
4444
import {
45+
useDataProvider,
4546
useDataProviderCheck,
4647
useInspectorDataProvider,
4748
} from "@/components/actors";
@@ -392,6 +393,7 @@ const Subnav = () => {
392393
: { to: "/", fuzzy: true },
393394
);
394395
const hasDataProvider = useDataProviderCheck();
396+
const hasQuery = !!useDataProvider().buildsQueryOptions;
395397

396398
if (nsMatch === false) {
397399
return null;
@@ -409,7 +411,7 @@ const Subnav = () => {
409411
Connect
410412
</HeaderLink>
411413
) : null}
412-
{hasDataProvider ? (
414+
{hasDataProvider && hasQuery ? (
413415
<div className="w-full">
414416
<span className="block text-muted-foreground text-xs px-2 py-1 transition-colors mb-0.5">
415417
Instances
@@ -542,6 +544,7 @@ function CloudSidebarContent() {
542544
});
543545

544546
const hasDataProvider = useDataProviderCheck();
547+
const hasQuery = !!useDataProvider().buildsQueryOptions;
545548

546549
if (matchNamespace) {
547550
return (
@@ -554,7 +557,7 @@ function CloudSidebarContent() {
554557
>
555558
Connect
556559
</HeaderLink>
557-
{hasDataProvider ? (
560+
{hasDataProvider && hasQuery ? (
558561
<div className="w-full pt-1.5">
559562
<span className="block text-muted-foreground text-xs px-1 py-1 transition-colors mb-0.5">
560563
Instances

0 commit comments

Comments
 (0)