Skip to content

Commit

Permalink
Merge pull request #63 from franciscoBSalgueiro/62-app-crashes-when-t…
Browse files Browse the repository at this point in the history
…rying-to-go-to-the-database-tab-without-a-reference-database

Fix crash on database panel without reference db selected
  • Loading branch information
franciscoBSalgueiro authored Oct 29, 2023
2 parents e1b4fa5 + 54c27c0 commit ade55bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/panels/database/DatabasePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,17 @@ function PanelWithError(props: {
children: React.ReactNode;
}) {
const referenceDatabase = useAtomValue(referenceDbAtom);
let children = props.children;
if (props.type === "local" && !referenceDatabase) {
props.children = <NoDatabaseWarning />;
children = <NoDatabaseWarning />;
}
if (props.error && props.type !== "local") {
props.children = <Alert color="red">{props.error.toString()}</Alert>;
children = <Alert color="red">{props.error.toString()}</Alert>;
}

return (
<Tabs.Panel pt="xs" mr="xs" value={props.value}>
{props.children}
{children}
</Tabs.Panel>
);
}
Expand Down

0 comments on commit ade55bb

Please sign in to comment.