mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-18 23:36:22 +00:00
feat: closes pr/181
This commit is contained in:
29
hooks/useRevalidatePlaybackProgressCache.ts
Normal file
29
hooks/useRevalidatePlaybackProgressCache.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
/**
|
||||
* useRevalidatePlaybackProgressCache invalidates queries related to playback progress.
|
||||
*/
|
||||
export function useRevalidatePlaybackProgressCache() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const revalidate = () => {
|
||||
// List of all the queries to invalidate
|
||||
const queriesToInvalidate = [
|
||||
["item"],
|
||||
["resumeItems"],
|
||||
["continueWatching"],
|
||||
["nextUp-all"],
|
||||
["nextUp"],
|
||||
["episodes"],
|
||||
["seasons"],
|
||||
["home"],
|
||||
];
|
||||
|
||||
// Invalidate each query
|
||||
queriesToInvalidate.forEach((queryKey) => {
|
||||
queryClient.invalidateQueries({ queryKey });
|
||||
});
|
||||
};
|
||||
|
||||
return revalidate;
|
||||
}
|
||||
Reference in New Issue
Block a user