mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 15:17:17 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import storage from "@react-native-firebase/storage";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
@ -53,7 +53,7 @@ export const useChangeProfilePicture = (customUserId?: string) => {
|
||||
onSuccess: () => {
|
||||
// Invalidate queries to refresh profile data
|
||||
if (!customUserId) {
|
||||
queryClient.invalidateQueries("Profiles");
|
||||
queryClient.invalidateQueries({queryKey: ["Profiles"]});
|
||||
refreshProfileData();
|
||||
}
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import {UserProfile} from "@firebase/auth";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useUpdateUserData} from "@/hooks/firebase/useUpdateUserData";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {EventData} from "@/hooks/firebase/types/eventData";
|
||||
|
||||
@ -24,7 +24,7 @@ export const useCreateEvent = () => {
|
||||
.doc(docId)
|
||||
.set({
|
||||
...eventData,
|
||||
attendees: (eventData.attendees?.length ?? 0) === 0 ?? [currentUser?.uid],
|
||||
attendees: (eventData.attendees?.length ?? 0),
|
||||
creatorId: currentUser?.uid,
|
||||
familyId: profileData?.familyId
|
||||
}, {merge: true});
|
||||
@ -83,7 +83,7 @@ export const useCreateEventsFromProvider = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("events");
|
||||
queryClient.invalidateQueries({queryKey: ["events"]});
|
||||
}
|
||||
});
|
||||
};
|
@ -1,47 +1,44 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { IFeedback } from "@/contexts/FeedbackContext";
|
||||
|
||||
export const useCreateFeedback = () => {
|
||||
const {user: currentUser, profileData} = useAuthContext()
|
||||
const queryClients = useQueryClient()
|
||||
const { user: currentUser } = useAuthContext();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationKey: ["createFeedback"],
|
||||
mutationFn: async (feedback: Partial<IFeedback>) => {
|
||||
try {
|
||||
if (feedback.id) {
|
||||
const snapshot = await firestore()
|
||||
.collection("Feedbacks")
|
||||
.where("id", "==", feedback.id)
|
||||
.get();
|
||||
|
||||
if (!snapshot.empty) {
|
||||
const docId = snapshot.docs[0].id;
|
||||
await firestore()
|
||||
.collection("Feedbacks")
|
||||
.doc(docId)
|
||||
.set({
|
||||
...feedback,
|
||||
creatorId: currentUser?.uid,
|
||||
}, {merge: true});
|
||||
return;
|
||||
}
|
||||
}
|
||||
const newDoc = firestore().collection('Feedbacks').doc();
|
||||
await firestore()
|
||||
if (feedback.id) {
|
||||
const snapshot = await firestore()
|
||||
.collection("Feedbacks")
|
||||
.add({...feedback, id: newDoc.id, creatorId: currentUser?.uid});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
.where("id", "==", feedback.id)
|
||||
.get();
|
||||
|
||||
if (!snapshot.empty) {
|
||||
const docId = snapshot.docs[0].id;
|
||||
await firestore()
|
||||
.collection("Feedbacks")
|
||||
.doc(docId)
|
||||
.set({
|
||||
...feedback,
|
||||
creatorId: currentUser?.uid,
|
||||
}, { merge: true });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const newDoc = firestore().collection('Feedbacks').doc();
|
||||
await firestore()
|
||||
.collection("Feedbacks")
|
||||
.add({ ...feedback, id: newDoc.id, creatorId: currentUser?.uid });
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("feedbacks")
|
||||
queryClient.invalidateQueries({ queryKey: ["feedbacks"] });
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useCreateFeedbacksFromProvider = () => {
|
||||
const { user: currentUser } = useAuthContext();
|
||||
@ -50,36 +47,29 @@ export const useCreateFeedbacksFromProvider = () => {
|
||||
return useMutation({
|
||||
mutationKey: ["createFeedbacksFromProvider"],
|
||||
mutationFn: async (feedbackDataArray: Partial<IFeedback>[]) => {
|
||||
try {
|
||||
const promises = feedbackDataArray.map(async (feedbackData) => {
|
||||
console.log("Processing FeedbackData: ", feedbackData);
|
||||
const promises = feedbackDataArray.map(async (feedbackData) => {
|
||||
const snapshot = await firestore()
|
||||
.collection("Feedbacks")
|
||||
.where("id", "==", feedbackData.id)
|
||||
.get();
|
||||
|
||||
const snapshot = await firestore()
|
||||
if (snapshot.empty) {
|
||||
return firestore()
|
||||
.collection("Feedbacks")
|
||||
.where("id", "==", feedbackData.id)
|
||||
.get();
|
||||
.add({ ...feedbackData, creatorId: currentUser?.uid });
|
||||
}
|
||||
|
||||
if (snapshot.empty) {
|
||||
return firestore()
|
||||
.collection("Feedbacks")
|
||||
.add({ ...feedbackData, creatorId: currentUser?.uid });
|
||||
} else {
|
||||
const docId = snapshot.docs[0].id;
|
||||
return firestore()
|
||||
.collection("Feedbacks")
|
||||
.doc(docId)
|
||||
.set({ ...feedbackData, creatorId: currentUser?.uid }, { merge: true });
|
||||
}
|
||||
});
|
||||
const docId = snapshot.docs[0].id;
|
||||
return firestore()
|
||||
.collection("Feedbacks")
|
||||
.doc(docId)
|
||||
.set({ ...feedbackData, creatorId: currentUser?.uid }, { merge: true });
|
||||
});
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
} catch (e) {
|
||||
console.error("Error creating/updating feedbacks: ", e);
|
||||
}
|
||||
await Promise.all(promises);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("feedbacks");
|
||||
queryClient.invalidateQueries({ queryKey: ["feedbacks"] });
|
||||
}
|
||||
});
|
||||
};
|
@ -1,26 +1,30 @@
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import {IGrocery} from "@/hooks/firebase/types/groceryData";
|
||||
import { IGrocery } from "@/hooks/firebase/types/groceryData";
|
||||
|
||||
export const useCreateGrocery = () => {
|
||||
const { user: currentUser, profileData } = useAuthContext();
|
||||
const queryClients = useQueryClient();
|
||||
const queryClient = useQueryClient();
|
||||
const groceriesKey = ["groceries"];
|
||||
|
||||
return useMutation({
|
||||
mutationKey: ["createGrocery"],
|
||||
mutationFn: async (groceryData: Partial<IGrocery>) => {
|
||||
try {
|
||||
const newDoc = firestore().collection('Groceries').doc();
|
||||
await firestore()
|
||||
.collection("Groceries")
|
||||
.add({...groceryData, id: newDoc.id, familyId: profileData?.familyId, creatorId: currentUser?.uid})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
mutationFn: (groceryData: Partial<IGrocery>) => {
|
||||
const newDoc = firestore().collection('Groceries').doc();
|
||||
return firestore()
|
||||
.collection("Groceries")
|
||||
.add({
|
||||
...groceryData,
|
||||
id: newDoc.id,
|
||||
familyId: profileData?.familyId,
|
||||
creatorId: currentUser?.uid
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("groceries")
|
||||
return queryClient.invalidateQueries({
|
||||
queryKey: groceriesKey,
|
||||
exact: true
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { IFeedback } from "@/contexts/FeedbackContext";
|
||||
import { IBrainDump } from "@/contexts/DumpContext";
|
||||
@ -42,7 +42,7 @@ export const useCreateNote = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("braindumps");
|
||||
queryClients.invalidateQueries({queryKey: ["braindumps"]});
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -85,7 +85,7 @@ export const useCreateNotesFromProvider = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("braindumps");
|
||||
queryClient.invalidateQueries({queryKey: ["braindumps"]});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import functions from '@react-native-firebase/functions';
|
||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { DAYS_OF_WEEK_ENUM, IToDo, REPEAT_TYPE } from "@/hooks/firebase/types/todoData";
|
||||
@ -141,7 +141,7 @@ export const useCreateTodo = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("todos")
|
||||
queryClients.invalidateQueries({queryKey: ["todos"]})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
export const useDeleteEvent = () => {
|
||||
@ -33,7 +33,7 @@ export const useDeleteEvent = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("events");
|
||||
queryClient.invalidateQueries({queryKey: ["events"]});
|
||||
}
|
||||
});
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
export const useDeleteFeedback = () => {
|
||||
@ -39,7 +39,7 @@ export const useDeleteFeedback = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("feedbacks");
|
||||
queryClient.invalidateQueries({queryKey: ["feedbacks"]});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
export const useDeleteGrocery = () => {
|
||||
@ -15,7 +15,7 @@ export const useDeleteGrocery = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("groceries");
|
||||
queryClient.invalidateQueries({queryKey: ["groceries"]});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
export const useDeleteNote = () => {
|
||||
@ -33,7 +33,7 @@ export const useDeleteNote = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("braindumps");
|
||||
queryClient.invalidateQueries({queryKey: ["braindumps"]});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -1,11 +1,12 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {Notification} from "@/hooks/firebase/useGetNotifications";
|
||||
import { Notification } from "@/hooks/firebase/useGetNotifications";
|
||||
|
||||
export const useDeleteNotification = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const {user} = useAuthContext();
|
||||
const { user } = useAuthContext();
|
||||
const notificationsKey = ["notifications", user?.uid];
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
@ -15,23 +16,24 @@ export const useDeleteNotification = () => {
|
||||
.delete();
|
||||
},
|
||||
onMutate: async (deletedId) => {
|
||||
await queryClient.cancelQueries(["notifications", user?.uid]);
|
||||
await queryClient.cancelQueries({ queryKey: notificationsKey });
|
||||
|
||||
const previousNotifications = queryClient.getQueryData<Notification[]>(["notifications", user?.uid]);
|
||||
const previousNotifications = queryClient.getQueryData<Notification[]>(notificationsKey);
|
||||
|
||||
queryClient.setQueryData<Notification[]>(["notifications", user?.uid], (old) =>
|
||||
old?.filter((notification) => notification?.id! !== deletedId) ?? []
|
||||
queryClient.setQueryData<Notification[]>(
|
||||
notificationsKey,
|
||||
old => old?.filter(notification => notification?.id !== deletedId) ?? []
|
||||
);
|
||||
|
||||
return {previousNotifications};
|
||||
return { previousNotifications };
|
||||
},
|
||||
onError: (_err, _deletedId, context) => {
|
||||
if (context?.previousNotifications) {
|
||||
queryClient.setQueryData(["notifications", user?.uid], context.previousNotifications);
|
||||
queryClient.setQueryData(notificationsKey, context.previousNotifications);
|
||||
}
|
||||
},
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries(["notifications", user?.uid]);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: notificationsKey });
|
||||
}
|
||||
});
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import auth, {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation } from "react-query";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
export const useSignUp = () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useQuery} from "react-query";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import {ChildProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
|
@ -1,11 +1,10 @@
|
||||
import {useQuery, useQueryClient} from "react-query";
|
||||
import {useQuery, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useAtomValue} from "jotai";
|
||||
import {isFamilyViewAtom} from "@/components/pages/calendar/atoms";
|
||||
import {colorMap} from "@/constants/colorMap";
|
||||
import {uuidv4} from "@firebase/util";
|
||||
import {useEffect} from "react";
|
||||
import {useEffect, useRef} from "react";
|
||||
|
||||
const createEventHash = (event: any): string => {
|
||||
const str = `${event.startDate?.seconds || ''}-${event.endDate?.seconds || ''}-${
|
||||
@ -21,214 +20,128 @@ const createEventHash = (event: any): string => {
|
||||
return hash.toString(36);
|
||||
};
|
||||
|
||||
const fetchEvents = async (userId: string, familyId: string | undefined, isFamilyView: boolean) => {
|
||||
const db = firestore();
|
||||
const eventsQuery = db.collection("Events");
|
||||
let constraints = [];
|
||||
|
||||
if (isFamilyView) {
|
||||
constraints = [
|
||||
eventsQuery.where("familyId", "==", familyId).where("private", "==", false),
|
||||
eventsQuery.where("creatorId", "==", userId),
|
||||
eventsQuery.where("attendees", "array-contains", userId)
|
||||
];
|
||||
} else {
|
||||
constraints = [
|
||||
eventsQuery.where("creatorId", "==", userId),
|
||||
eventsQuery.where("attendees", "array-contains", userId)
|
||||
];
|
||||
}
|
||||
|
||||
const snapshots = await Promise.all(constraints.map(query => query.get()));
|
||||
|
||||
const uniqueEvents = new Map();
|
||||
const processedHashes = new Set();
|
||||
const creatorIds = new Set();
|
||||
|
||||
snapshots.forEach(snapshot => {
|
||||
snapshot.docs.forEach(doc => {
|
||||
const event = doc.data();
|
||||
const hash = createEventHash(event);
|
||||
|
||||
if (!processedHashes.has(hash)) {
|
||||
processedHashes.add(hash);
|
||||
creatorIds.add(event.creatorId);
|
||||
uniqueEvents.set(doc.id, event);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const creatorIdsArray = Array.from(creatorIds);
|
||||
const creatorProfiles = new Map();
|
||||
|
||||
for (let i = 0; i < creatorIdsArray.length; i += 10) {
|
||||
const chunk = creatorIdsArray.slice(i, i + 10);
|
||||
const profilesSnapshot = await db
|
||||
.collection("Profiles")
|
||||
.where(firestore.FieldPath.documentId(), "in", chunk)
|
||||
.get();
|
||||
|
||||
profilesSnapshot.docs.forEach(doc => {
|
||||
creatorProfiles.set(doc.id, doc.data()?.eventColor || colorMap.pink);
|
||||
});
|
||||
}
|
||||
|
||||
return Array.from(uniqueEvents.entries()).map(([id, event]) => ({
|
||||
...event,
|
||||
id,
|
||||
start: event.allDay
|
||||
? new Date(new Date(event.startDate.seconds * 1000).setHours(0, 0, 0, 0))
|
||||
: new Date(event.startDate.seconds * 1000),
|
||||
end: event.allDay
|
||||
? new Date(new Date(event.endDate.seconds * 1000).setHours(0, 0, 0, 0))
|
||||
: new Date(event.endDate.seconds * 1000),
|
||||
hideHours: event.allDay,
|
||||
eventColor: creatorProfiles.get(event.creatorId) || colorMap.pink,
|
||||
notes: event.notes
|
||||
}));
|
||||
};
|
||||
|
||||
export const useGetEvents = () => {
|
||||
const {user, profileData} = useAuthContext();
|
||||
const { user, profileData } = useAuthContext();
|
||||
const isFamilyView = useAtomValue(isFamilyViewAtom);
|
||||
const queryClient = useQueryClient();
|
||||
const lastSyncTimestamp = useRef<number>(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (!profileData?.familyId) {
|
||||
console.log('[SYNC] No family ID available, skipping listener setup');
|
||||
return;
|
||||
}
|
||||
if (!user?.uid || !profileData?.familyId) return;
|
||||
|
||||
console.log('[SYNC] Setting up sync listener', {
|
||||
familyId: profileData.familyId,
|
||||
userId: user?.uid,
|
||||
isFamilyView
|
||||
});
|
||||
const prefetchEvents = async () => {
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: ["events", user.uid, false], // Personal events
|
||||
queryFn: () => fetchEvents(user.uid, profileData.familyId, false),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: ["events", user.uid, true], // Family events
|
||||
queryFn: () => fetchEvents(user.uid, profileData.familyId, true),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
};
|
||||
|
||||
prefetchEvents();
|
||||
|
||||
const unsubscribe = firestore()
|
||||
.collection('Households')
|
||||
.where("familyId", "==", profileData.familyId)
|
||||
.onSnapshot((snapshot) => {
|
||||
console.log('[SYNC] Snapshot received', {
|
||||
empty: snapshot.empty,
|
||||
size: snapshot.size,
|
||||
changes: snapshot.docChanges().length
|
||||
});
|
||||
|
||||
snapshot.docChanges().forEach((change) => {
|
||||
console.log('[SYNC] Processing change', {
|
||||
type: change.type,
|
||||
docId: change.doc.id,
|
||||
newData: change.doc.data()
|
||||
});
|
||||
|
||||
if (change.type === 'modified') {
|
||||
const data = change.doc.data();
|
||||
console.log('[SYNC] Modified document data', {
|
||||
hasLastSyncTimestamp: !!data?.lastSyncTimestamp,
|
||||
hasLastUpdateTimestamp: !!data?.lastUpdateTimestamp,
|
||||
allFields: Object.keys(data || {})
|
||||
});
|
||||
|
||||
if (data?.lastSyncTimestamp) {
|
||||
console.log('[SYNC] Sync timestamp change detected', {
|
||||
timestamp: data.lastSyncTimestamp.toDate(),
|
||||
householdId: change.doc.id,
|
||||
queryKey: ["events", user?.uid, isFamilyView]
|
||||
});
|
||||
|
||||
console.log('[SYNC] Invalidating queries...');
|
||||
queryClient.invalidateQueries(["events", user?.uid, isFamilyView]);
|
||||
console.log('[SYNC] Queries invalidated');
|
||||
} else {
|
||||
console.log('[SYNC] Modified document without lastSyncTimestamp', {
|
||||
householdId: change.doc.id
|
||||
});
|
||||
const newTimestamp = data.lastSyncTimestamp.seconds;
|
||||
if (newTimestamp > lastSyncTimestamp.current) {
|
||||
lastSyncTimestamp.current = newTimestamp;
|
||||
// Invalidate both queries
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["events", user.uid]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, (error) => {
|
||||
console.error('[SYNC] Listener error:', {
|
||||
message: error.message,
|
||||
code: error.code,
|
||||
stack: error.stack
|
||||
});
|
||||
});
|
||||
|
||||
console.log('[SYNC] Listener setup complete');
|
||||
|
||||
return () => {
|
||||
console.log('[SYNC] Cleaning up sync listener', {
|
||||
familyId: profileData.familyId,
|
||||
userId: user?.uid
|
||||
});
|
||||
unsubscribe();
|
||||
};
|
||||
}, [profileData?.familyId, user?.uid, isFamilyView, queryClient]);
|
||||
}, console.error);
|
||||
|
||||
return unsubscribe;
|
||||
}, [profileData?.familyId, user?.uid, queryClient]);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ["events", user?.uid, isFamilyView],
|
||||
queryFn: async () => {
|
||||
console.log(`Fetching events - Family View: ${isFamilyView}, User: ${user?.uid}`);
|
||||
|
||||
const db = firestore();
|
||||
const userId = user?.uid;
|
||||
const familyId = profileData?.familyId;
|
||||
let allEvents = [];
|
||||
|
||||
if (isFamilyView) {
|
||||
const [publicFamilyEvents, privateCreatorEvents, privateAttendeeEvents, userAttendeeEvents, userCreatorEvents] = await Promise.all([
|
||||
// Public family events
|
||||
db.collection("Events")
|
||||
.where("familyId", "==", familyId)
|
||||
.where("private", "==", false)
|
||||
.get(),
|
||||
|
||||
// Private events user created
|
||||
db.collection("Events")
|
||||
.where("familyId", "==", familyId)
|
||||
.where("private", "==", true)
|
||||
.where("creatorId", "==", userId)
|
||||
.get(),
|
||||
|
||||
// Private events user is attending
|
||||
db.collection("Events")
|
||||
.where("private", "==", true)
|
||||
.where("attendees", "array-contains", userId)
|
||||
.get(),
|
||||
|
||||
// All events where user is attendee
|
||||
db.collection("Events")
|
||||
.where("attendees", "array-contains", userId)
|
||||
.get(),
|
||||
|
||||
// ALL events where user is creator (regardless of attendees)
|
||||
db.collection("Events")
|
||||
.where("creatorId", "==", userId)
|
||||
.get()
|
||||
]);
|
||||
|
||||
console.log(`Found ${publicFamilyEvents.size} public events, ${privateCreatorEvents.size} private creator events, ${privateAttendeeEvents.size} private attendee events, ${userAttendeeEvents.size} user attendee events, ${userCreatorEvents.size} user creator events`);
|
||||
|
||||
allEvents = [
|
||||
...publicFamilyEvents.docs.map(doc => ({...doc.data(), id: doc.id})),
|
||||
...privateCreatorEvents.docs.map(doc => ({...doc.data(), id: doc.id})),
|
||||
...privateAttendeeEvents.docs.map(doc => ({...doc.data(), id: doc.id})),
|
||||
...userAttendeeEvents.docs.map(doc => ({...doc.data(), id: doc.id})),
|
||||
...userCreatorEvents.docs.map(doc => ({...doc.data(), id: doc.id}))
|
||||
];
|
||||
} else {
|
||||
const [creatorEvents, attendeeEvents] = await Promise.all([
|
||||
db.collection("Events")
|
||||
.where("creatorId", "==", userId)
|
||||
.get(),
|
||||
db.collection("Events")
|
||||
.where("attendees", "array-contains", userId)
|
||||
.get()
|
||||
]);
|
||||
|
||||
console.log(`Found ${creatorEvents.size} creator events, ${attendeeEvents.size} attendee events`);
|
||||
|
||||
allEvents = [
|
||||
...creatorEvents.docs.map(doc => ({...doc.data(), id: doc.id})),
|
||||
...attendeeEvents.docs.map(doc => ({...doc.data(), id: doc.id}))
|
||||
];
|
||||
}
|
||||
|
||||
const uniqueEventsMap = new Map();
|
||||
const processedHashes = new Set();
|
||||
|
||||
allEvents.forEach(event => {
|
||||
const eventHash = createEventHash(event);
|
||||
|
||||
console.log(`Processing ${uniqueEventsMap.size} unique events`);
|
||||
|
||||
const processedEvent = {
|
||||
...event,
|
||||
id: event.id || uuidv4(),
|
||||
creatorId: event.creatorId || userId
|
||||
};
|
||||
|
||||
// Only add the event if we haven't seen this hash before
|
||||
if (!processedHashes.has(eventHash)) {
|
||||
processedHashes.add(eventHash);
|
||||
uniqueEventsMap.set(processedEvent.id, processedEvent);
|
||||
} else {
|
||||
console.log(`Duplicate event detected and skipped using hash: ${eventHash}`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Processing ${uniqueEventsMap.size} unique events after deduplication`);
|
||||
|
||||
const processedEvents = await Promise.all(
|
||||
Array.from(uniqueEventsMap.values()).map(async (event) => {
|
||||
const profileSnapshot = await db
|
||||
.collection("Profiles")
|
||||
.doc(event.creatorId)
|
||||
.get();
|
||||
|
||||
const profileData = profileSnapshot.data();
|
||||
const eventColor = profileData?.eventColor || colorMap.pink;
|
||||
|
||||
return {
|
||||
...event,
|
||||
start: event.allDay
|
||||
? new Date(new Date(event.startDate.seconds * 1000).setHours(0, 0, 0, 0))
|
||||
: new Date(event.startDate.seconds * 1000),
|
||||
end: event.allDay
|
||||
? new Date(new Date(event.endDate.seconds * 1000).setHours(0, 0, 0, 0))
|
||||
: new Date(event.endDate.seconds * 1000),
|
||||
hideHours: event.allDay,
|
||||
eventColor,
|
||||
notes: event.notes,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
console.log(`Events processing completed, returning ${processedEvents.length} events`);
|
||||
return processedEvents;
|
||||
},
|
||||
queryFn: () => fetchEvents(user?.uid!, profileData?.familyId, isFamilyView),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
cacheTime: 30 * 60 * 1000,
|
||||
keepPreviousData: true,
|
||||
onError: (error) => {
|
||||
console.error('Error fetching events:', error);
|
||||
}
|
||||
gcTime: Infinity,
|
||||
placeholderData: (previousData) => previousData,
|
||||
enabled: Boolean(user?.uid),
|
||||
});
|
||||
};
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
import {useQuery} from "react-query";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useQuery } from "react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { IFeedback } from "@/contexts/FeedbackContext";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useQuery} from "react-query";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
|
||||
|
@ -1,36 +1,30 @@
|
||||
import { useQuery } from "react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
export const useGetHouseholdName = (familyId: string) => {
|
||||
return useQuery(
|
||||
["getHouseholdName", familyId], // Unique query key
|
||||
async () => {
|
||||
console.log(`Fetching household name for familyId: ${familyId}`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ["household", familyId],
|
||||
queryFn: async () => {
|
||||
try {
|
||||
// Query the Households collection for the given familyId
|
||||
const snapshot = await firestore()
|
||||
.collection("Households")
|
||||
.where("familyId", "==", familyId)
|
||||
.get();
|
||||
.collection("Households")
|
||||
.where("familyId", "==", familyId)
|
||||
.get();
|
||||
|
||||
if (!snapshot.empty) {
|
||||
// Extract the name from the first matching document
|
||||
const householdData = snapshot.docs[0].data();
|
||||
console.log("Household found:", householdData);
|
||||
return householdData.name || null; // Return the name or null if missing
|
||||
} else {
|
||||
console.log("No household found for the given familyId.");
|
||||
return null; // Return null if no household found
|
||||
return householdData.name ?? null;
|
||||
}
|
||||
|
||||
console.log("No household found for the given familyId.");
|
||||
return null;
|
||||
} catch (e) {
|
||||
console.error("Error fetching household name:", e);
|
||||
throw e; // Ensure error propagates to the query error handling
|
||||
throw e;
|
||||
}
|
||||
},
|
||||
{
|
||||
enabled: !!familyId, // Only fetch if familyId is provided
|
||||
staleTime: 5 * 60 * 1000, // Cache the data for 5 minutes
|
||||
}
|
||||
);
|
||||
};
|
||||
enabled: Boolean(familyId),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useQuery } from "react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { IBrainDump } from "@/contexts/DumpContext";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useQuery } from "react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
|
||||
@ -35,11 +35,11 @@ export const useGetNotifications = () => {
|
||||
const snapshot = await firestore()
|
||||
.collection("Notifications")
|
||||
.where("familyId", "==", profileData?.familyId)
|
||||
.orderBy("timestamp", "desc")
|
||||
.get();
|
||||
|
||||
return snapshot.docs.map((doc) => {
|
||||
const data = doc.data() as NotificationFirestore;
|
||||
|
||||
return {
|
||||
id: doc.id,
|
||||
...data,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useQuery } from "react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import firestore, {or, query, where} from "@react-native-firebase/firestore";
|
||||
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
|
||||
import { IToDo } from "@/hooks/firebase/types/todoData";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useQuery } from "react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import functions, {FirebaseFunctionsTypes} from '@react-native-firebase/functions';
|
||||
import auth from "@react-native-firebase/auth";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import functions from '@react-native-firebase/functions';
|
||||
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
|
||||
import { HttpsCallableResult } from "@firebase/functions";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import auth from "@react-native-firebase/auth";
|
||||
|
||||
export const useResetPassword = () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation } from "react-query";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import auth from "@react-native-firebase/auth";
|
||||
|
||||
export const useSignIn = () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import auth from "@react-native-firebase/auth";
|
||||
import {useRouter} from "expo-router";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import auth from "@react-native-firebase/auth";
|
||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useSetUserData} from "./useSetUserData";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {EventData} from "@/hooks/firebase/types/eventData";
|
||||
|
||||
@ -18,7 +18,7 @@ export const useUpdateEvent = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("events")
|
||||
queryClients.invalidateQueries({queryKey: ["events"]})
|
||||
}
|
||||
})
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { IFeedback } from "@/contexts/FeedbackContext";
|
||||
|
||||
@ -54,7 +54,7 @@ export const useUpdateFeedback = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: (updatedFeedback) => {
|
||||
queryClient.invalidateQueries("feedbacks");
|
||||
queryClient.invalidateQueries({queryKey: ["feedbacks"]})
|
||||
|
||||
queryClient.setQueryData(
|
||||
["feedback", updatedFeedback.id],
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {IGrocery} from "@/hooks/firebase/types/groceryData";
|
||||
|
||||
@ -18,7 +18,7 @@ export const useUpdateGrocery = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("groceries")
|
||||
queryClients.invalidateQueries({queryKey: ["groceries"]})
|
||||
}
|
||||
})
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
export const useUpdateHouseholdName = () => {
|
||||
const queryClient = useQueryClient();
|
||||
@ -44,7 +44,7 @@ export const useUpdateHouseholdName = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("households"); // Invalidate the "households" query to refresh data
|
||||
queryClient.invalidateQueries({queryKey: ["households"]}); // Invalidate the "households" query to refresh data
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { IBrainDump } from "@/contexts/DumpContext";
|
||||
|
||||
@ -54,7 +54,7 @@ export const useUpdateNote = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: (updatedNote) => {
|
||||
queryClient.invalidateQueries("braindumps");
|
||||
queryClient.invalidateQueries({queryKey: ["braindumps"]});
|
||||
|
||||
queryClient.setQueryData(
|
||||
["feedback", updatedNote.id],
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {IToDo, REPEAT_TYPE} from "@/hooks/firebase/types/todoData";
|
||||
import {addDays, addMonths, addWeeks, addYears, compareAsc, format, subDays} from "date-fns";
|
||||
@ -165,7 +165,7 @@ export const useUpdateTodo = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClients.invalidateQueries("todos")
|
||||
queryClients.invalidateQueries({queryKey: ["todos"]})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
|
||||
@ -51,7 +51,7 @@ export const useUpdateUserData = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("events");
|
||||
queryClient.invalidateQueries({queryKey: ["events"]})
|
||||
},
|
||||
});
|
||||
};
|
@ -9,7 +9,7 @@ import * as Google from "expo-auth-session/providers/google";
|
||||
import * as AuthSession from "expo-auth-session";
|
||||
import * as AppleAuthentication from "expo-apple-authentication";
|
||||
import * as Notifications from 'expo-notifications';
|
||||
import {useQueryClient} from "react-query";
|
||||
import {useQueryClient} from "@tanstack/react-query";
|
||||
import {AppleAccount, GoogleAccount, MicrosoftAccount} from "@/hooks/firebase/types/profileTypes";
|
||||
|
||||
const googleConfig = {
|
||||
@ -302,7 +302,7 @@ export const useCalSync = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const handleNotification = async (notification: Notifications.Notification) => {
|
||||
queryClient.invalidateQueries(["events"]);
|
||||
queryClient.invalidateQueries({queryKey: ["events"]});
|
||||
};
|
||||
|
||||
const sub = Notifications.addNotificationReceivedListener(handleNotification);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||
import {fetchiPhoneCalendarEvents} from "@/calendar-integration/apple-calendar-utils";
|
||||
@ -23,7 +23,6 @@ export const useFetchAndSaveAppleEvents = () => {
|
||||
timeMax
|
||||
);
|
||||
|
||||
console.log(response);
|
||||
const items = response ?? [];
|
||||
await createEventsFromProvider(items);
|
||||
} catch (error) {
|
||||
@ -32,7 +31,7 @@ export const useFetchAndSaveAppleEvents = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(["events"])
|
||||
queryClient.invalidateQueries({queryKey: ["events"]})
|
||||
},
|
||||
});
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import functions from "@react-native-firebase/functions";
|
||||
|
||||
@ -30,7 +30,7 @@ export const useFetchAndSaveGoogleEvents = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
queryClient.invalidateQueries(["events"]);
|
||||
queryClient.invalidateQueries({queryKey: ["events"]});
|
||||
console.log(`Successfully synced ${data.eventCount} events`);
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useSetUserData } from "@/hooks/firebase/useSetUserData";
|
||||
import functions from '@react-native-firebase/functions';
|
||||
@ -130,7 +130,7 @@ export const useFetchAndSaveMicrosoftEvents = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
queryClient.invalidateQueries(["events"]);
|
||||
queryClient.invalidateQueries({queryKey: ["events"]});
|
||||
console.log(`Successfully synced ${data.eventCount} Microsoft events`);
|
||||
},
|
||||
onError: (error) => {
|
||||
|
Reference in New Issue
Block a user