Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Update PATH_WITH_COLLAPSED_NAVBAR to not close on all routes with question (#72374)

Nick Fitzpatricke1438f4c42a0
diff --git a/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx b/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx
index 2f8d15f3d87..6f8518d1556 100644
--- a/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx
+++ b/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx
@@ -131,6 +131,16 @@ describe("nav > containers > Navbar > Core App", () => {
await expectNavbarClosed();
});
+ it("should stay open when navigating to the database reference questions page (metabase#72001)", async () => {
+ const store = await setup({ pathname: "/reference/databases/1" });
+ await expectNavbarOpen();
+ dispatchLocationChange({
+ store,
+ pathname: "/reference/databases/1/tables/2/questions",
+ });
+ await expectNavbarOpen();
+ });
+
it("should hide when visiting a question and stay hidden when returning to collection", async () => {
const store = await setup({ pathname: "/collection/1" });
await expectNavbarOpen();
diff --git a/frontend/src/metabase/redux/app.ts b/frontend/src/metabase/redux/app.ts
index 6be3a1dfc89..6fa5dc33246 100644
--- a/frontend/src/metabase/redux/app.ts
+++ b/frontend/src/metabase/redux/app.ts
@@ -66,9 +66,10 @@ const errorPage = handleActions(
);
// regexr.com/7r89i
-// A word boundary is added to /model so it doesn't match /browse/models
+// Word boundaries are added so partial matches don't collapse the navbar
+// e.g. /model shouldn't match /browse/models, /question shouldn't match /reference/.../questions
const PATH_WITH_COLLAPSED_NAVBAR =
- /\/(model\b|question|dashboard|metabot|document|explore).*/;
+ /\/(model\b|question\b|dashboard|metabot|document|explore).*/;
export function isNavbarOpenForPathname(pathname: string, prevState: boolean) {
return (