This commit is contained in:
Shusui MOYATANI
2023-03-04 12:59:45 +09:00
parent 7cc2a304dc
commit 4be810523d
13 changed files with 221 additions and 99 deletions

View File

@@ -31,6 +31,7 @@ const { exec } = useBatchedEvents<UseDeprecatedRepostsProps>(() => ({
const useDeprecatedReposts = (
propsProvider: () => UseDeprecatedRepostsProps,
): UseDeprecatedReposts => {
const queryClient = useQueryClient();
const props = createMemo(propsProvider);
const queryKey = createMemo(() => ['useDeprecatedReposts', props()] as const);
@@ -55,10 +56,8 @@ const useDeprecatedReposts = (
const isRepostedBy = (pubkey: string): boolean =>
reposts().findIndex((event) => event.pubkey === pubkey) !== -1;
const invalidateDeprecatedReposts = (): Promise<void> => {
const queryClient = useQueryClient();
return queryClient.invalidateQueries(queryKey());
};
const invalidateDeprecatedReposts = (): Promise<void> =>
queryClient.invalidateQueries(queryKey());
return { reposts, isRepostedBy, invalidateDeprecatedReposts, query };
};