Skip to content

Commit 8c6dae5

Browse files
fix cache invalidation and refresh button inconsistencies
1 parent 5a5c3f9 commit 8c6dae5

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

web/renderer/components/DatabaseHeaderAndNav/RefreshConnectionButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ import useMutation from "@hooks/useMutation";
1010
import { IoReloadSharp } from "@react-icons/all-files/io5/IoReloadSharp";
1111
import { useState } from "react";
1212
import css from "./index.module.css";
13+
import { useRouter } from "next/router";
1314

1415
export default function ResetConnectionButton() {
1516
const { mutateFn, loading, err, setErr, client } = useMutation({
1617
hook: useResetDatabaseMutation,
1718
});
19+
const router = useRouter();
1820
const [errorModalOpen, setErrorModalOpen] = useState(false);
1921

2022
const onClick = async () => {
2123
await mutateFn();
2224
await client.resetStore();
25+
router.reload();
2326
};
2427

2528
const onClose = () => {

web/renderer/components/pageComponents/DatabasePage/ForTable/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ type Props = {
1212
};
1313

1414
export default function ForTable(props: Props) {
15+
if (!props.params.tableName) {
16+
return null;
17+
}
1518
const { schemaName, tableName } = getSchemaAndTableName(props.params);
1619
const params = { ...props.params, schemaName, tableName };
1720
return (

web/renderer/lib/apollo.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export function createApolloClient(
3434
uri,
3535
headers,
3636
}),
37+
defaultOptions: {
38+
watchQuery: {
39+
fetchPolicy: "cache-and-network",
40+
},
41+
},
3742
});
3843
}
3944

0 commit comments

Comments
 (0)