Don't invalidate reminders when saving
This commit is contained in:
@ -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 />}
|
||||
|
Reference in New Issue
Block a user