fix: add cache invalidation after creating Availability (#23221)

Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
This commit is contained in:
mdm317
2025-08-31 14:18:47 +00:00
committed by GitHub
co-authored by Kartik Saini Anik Dhabal Babu
parent 5ebd33576a
commit bf3037d57e
@@ -1,3 +1,4 @@
import { revalidateAvailabilityList } from "app/(use-page-wrapper)/(main-nav)/availability/actions";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
@@ -31,6 +32,7 @@ export function NewScheduleButton({
onSuccess: async ({ schedule }) => {
await router.push(`/availability/${schedule.id}${fromEventType ? "?fromEventType=true" : ""}`);
showToast(t("schedule_created_successfully", { scheduleName: schedule.name }), "success");
revalidateAvailabilityList();
utils.viewer.availability.list.setData(undefined, (data) => {
const newSchedule = { ...schedule, isDefault: false, availability: [] };
if (!data)