Skip to content

chore: simplify workspace routing #17981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 27, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't use state or effect
  • Loading branch information
BrunoQuaresma committed May 22, 2025
commit f09266ac14dafac45f01cdf99f232788ea07e1ab
15 changes: 5 additions & 10 deletions site/src/modules/dashboard/DeploymentBanner/DeploymentBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { health } from "api/queries/debug";
import { deploymentStats } from "api/queries/deployment";
import { useAuthenticated } from "hooks";
import { type FC, useEffect, useState } from "react";
import type { FC } from "react";
import { useQuery } from "react-query";
import { useLocation } from "react-router-dom";
import { DeploymentBannerView } from "./DeploymentBannerView";
Expand All @@ -20,17 +20,12 @@ export const DeploymentBanner: FC = () => {
enabled: permissions.viewDeploymentConfig,
});
const location = useLocation();
const [visible, setVisible] = useState(true);

useEffect(() => {
const isHidden = HIDE_DEPLOYMENT_BANNER_PATHS.some((regex) =>
regex.test(location.pathname),
);
setVisible(!isHidden);
}, [location.pathname]);
const isHidden = HIDE_DEPLOYMENT_BANNER_PATHS.some((regex) =>
regex.test(location.pathname),
);

if (
!visible ||
isHidden ||
!permissions.viewDeploymentConfig ||
!deploymentStatsQuery.data
) {
Expand Down
Loading