refetch sync.enabled when sync is enabled (#2489)

This commit is contained in:
Brendan Allan 2024-05-15 13:14:12 +08:00 committed by GitHub
parent 1eb98cea67
commit 8a960c05f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,7 +53,9 @@ export const Component = () => {
className="text-nowrap"
variant="accent"
onClick={() => {
dialogManager.create((dialogProps) => <SyncBackfillDialog {...dialogProps} />);
dialogManager.create((dialogProps) => (
<SyncBackfillDialog onEnabled={() => syncEnabled.refetch()} {...dialogProps} />
));
}}
disabled={backfillSync.isLoading}
>
@ -89,7 +91,7 @@ export const Component = () => {
);
};
function SyncBackfillDialog(props: UseDialogProps) {
function SyncBackfillDialog(props: UseDialogProps & { onEnabled: () => void }) {
const form = useZodForm({ schema: z.object({}) });
const dialog = useDialog(props);
@ -100,6 +102,7 @@ function SyncBackfillDialog(props: UseDialogProps) {
form.handleSubmit(
async () => {
await enableSync.mutateAsync(null).then(() => (dialog.state.open = false));
await props.onEnabled();
},
() => {}
)();