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:
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)
|
||||
|
||||
Reference in New Issue
Block a user