Skip to content

Commit

Permalink
chore: reload calendars and lists after opening calendar settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
bobalazek committed Oct 14, 2024
1 parent 7bb0774 commit 46ae528
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CogIcon } from 'lucide-react';
import { useEffect } from 'react';

import {
Button,
Expand All @@ -24,9 +25,25 @@ export type CalendarSettingsDialogProps = {
};

export default function CalendarSettingsDialog({ includeTrigger }: CalendarSettingsDialogProps) {
const { settingsDialogOpen, setSettingsDialogOpen, calendars, userCalendars } =
useCalendarStore();
const { lists } = useListsStore();
const {
settingsDialogOpen,
setSettingsDialogOpen,
calendars,
userCalendars,
reloadCalendars,
reloadUserCalendars,
} = useCalendarStore();
const { lists, reloadLists } = useListsStore();

useEffect(() => {
if (!settingsDialogOpen) {
return;
}

reloadCalendars();
reloadUserCalendars();
reloadLists();
}, [settingsDialogOpen, reloadCalendars, reloadUserCalendars, reloadLists]);

return (
<Dialog open={settingsDialogOpen} onOpenChange={setSettingsDialogOpen}>
Expand Down

0 comments on commit 46ae528

Please sign in to comment.