Skip to content

Commit

Permalink
fix(web): mount the issues drawer always
Browse files Browse the repository at this point in the history
Instead of doing it dinamically since the IssuesDrawer already have logic for
rendering nothing when needed. This approach helps to avoid having calls
to a query when the QueryClient has not been set yet, like at login
screen.
  • Loading branch information
dgdavid committed Nov 21, 2024
1 parent 67ca130 commit 1833db9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions web/src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { Page } from "@patternfly/react-core";
import Header, { HeaderProps } from "~/components/layout/Header";
import { Loading, Sidebar } from "~/components/layout";
import { IssuesDrawer } from "~/components/core";
import { useAllIssues } from "~/queries/issues";

type LayoutProps = React.PropsWithChildren<{
mountHeader?: boolean;
Expand All @@ -46,13 +45,10 @@ const Layout = ({
headerOptions = {},
children,
}: LayoutProps) => {
const issues = useAllIssues();
const [issuesDrawerVisible, setIssuesDrawerVisible] = useState<boolean>(false);
const closeIssuesDrawer = () => setIssuesDrawerVisible(false);
const toggleIssuesDrawer = () => setIssuesDrawerVisible(!issuesDrawerVisible);

const mountIssuesDrawer = !issues.isEmpty;

return (
<Page
isManagedSidebar
Expand All @@ -67,7 +63,7 @@ const Layout = ({
)
}
sidebar={mountSidebar && <Sidebar />}
notificationDrawer={mountIssuesDrawer && <IssuesDrawer onClose={closeIssuesDrawer} />}
notificationDrawer={<IssuesDrawer onClose={closeIssuesDrawer} />}
isNotificationDrawerExpanded={issuesDrawerVisible}
>
<Suspense fallback={<Loading />}>{children || <Outlet />}</Suspense>
Expand Down

0 comments on commit 1833db9

Please sign in to comment.