Don't invalidate reminders when saving

This commit is contained in:
jude
2024-03-29 16:15:01 +00:00
parent d15a66d9d9
commit a770a17ee7
4 changed files with 15 additions and 17 deletions

View File

@ -1,8 +1,8 @@
import { useQuery } from "react-query";
import { useQuery, useQueryClient } from "react-query";
import { fetchGuildChannels, fetchGuildReminders } from "../../api";
import { EditReminder } from "../Reminder/EditReminder";
import { CreateReminder } from "../Reminder/CreateReminder";
import { useState } from "preact/hooks";
import { useCallback, useState } from "preact/hooks";
import { Loader } from "../Loader";
import { useGuild } from "../App/useGuild";
@ -24,10 +24,16 @@ export const GuildReminders = () => {
const { data: channels } = useQuery(fetchGuildChannels(guild));
const [collapsed, setCollapsed] = useState(false);
const [sort, setSort] = useState(Sort.Time);
const [sort, _setSort] = useState(Sort.Time);
const queryClient = useQueryClient();
let prevReminder = null;
const setSort = useCallback((sort) => {
queryClient.invalidateQueries(["GUILD_REMINDERS"]);
_setSort(sort);
}, []);
return (
<>
{!isFetched && <Loader />}