mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-06 10:46:46 +00:00
fix: use $api.queryOptions for batcher query keys
Replace custom meetingStatusKeys with $api.queryOptions()-derived keys so cache identity matches the original per-room GET endpoints.
This commit is contained in:
@@ -14,6 +14,10 @@ jest.mock("../apiClient", () => ({
|
|||||||
$api: {
|
$api: {
|
||||||
useQuery: jest.fn(),
|
useQuery: jest.fn(),
|
||||||
useMutation: jest.fn(),
|
useMutation: jest.fn(),
|
||||||
|
queryOptions: (method: string, path: string, init?: unknown) =>
|
||||||
|
init === undefined
|
||||||
|
? { queryKey: [method, path] }
|
||||||
|
: { queryKey: [method, path, init] },
|
||||||
},
|
},
|
||||||
API_URL: "http://test",
|
API_URL: "http://test",
|
||||||
WEBSOCKET_URL: "ws://test",
|
WEBSOCKET_URL: "ws://test",
|
||||||
|
|||||||
@@ -737,20 +737,18 @@ export function useRoomUpcomingMeetings(roomName: string | null) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const MEETINGS_PATH_PARTIAL = "meetings" as const;
|
// Query keys reuse $api.queryOptions so cache identity matches the original
|
||||||
const MEETINGS_ACTIVE_PATH_PARTIAL = `${MEETINGS_PATH_PARTIAL}/active` as const;
|
// per-room GET endpoints. The actual fetch goes through the batcher, but the
|
||||||
const MEETINGS_UPCOMING_PATH_PARTIAL =
|
// keys stay consistent with the rest of the codebase.
|
||||||
`${MEETINGS_PATH_PARTIAL}/upcoming` as const;
|
const meetingStatusKeys = {
|
||||||
const MEETING_LIST_PATH_PARTIALS = [
|
|
||||||
MEETINGS_ACTIVE_PATH_PARTIAL,
|
|
||||||
MEETINGS_UPCOMING_PATH_PARTIAL,
|
|
||||||
];
|
|
||||||
|
|
||||||
export const meetingStatusKeys = {
|
|
||||||
active: (roomName: string) =>
|
active: (roomName: string) =>
|
||||||
["rooms", roomName, MEETINGS_ACTIVE_PATH_PARTIAL] as const,
|
$api.queryOptions("get", "/v1/rooms/{room_name}/meetings/active", {
|
||||||
|
params: { path: { room_name: roomName } },
|
||||||
|
}).queryKey,
|
||||||
upcoming: (roomName: string) =>
|
upcoming: (roomName: string) =>
|
||||||
["rooms", roomName, MEETINGS_UPCOMING_PATH_PARTIAL] as const,
|
$api.queryOptions("get", "/v1/rooms/{room_name}/meetings/upcoming", {
|
||||||
|
params: { path: { room_name: roomName } },
|
||||||
|
}).queryKey,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function useRoomActiveMeetings(roomName: string | null) {
|
export function useRoomActiveMeetings(roomName: string | null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user