mirror of
https://github.com/MarcA711/frigate-rockchip.git
synced 2025-10-07 01:32:51 +08:00

* add genai to frigateconfig * add regenerate button if genai is enabled * add endpoint and new zmq pub/sub model * move publisher to app * dont override * logging * debug timeouts * clean up * clean up * allow saving of empty description * ensure descriptions can be empty * update search detail when results change * revalidate explore page on focus * global mutate hook * description websocket hook and dispatcher * revalidation and mutation * fix merge conflicts * update tests * fix merge conflicts * fix response message * fix response message * fix fastapi * fix test * remove log * json content * fix content response * more json content fixes * another one
17 lines
535 B
TypeScript
17 lines
535 B
TypeScript
// https://github.com/vercel/swr/issues/1670#issuecomment-1844114401
|
|
import { useCallback } from "react";
|
|
import { cache, mutate } from "swr/_internal";
|
|
|
|
const useGlobalMutation = () => {
|
|
return useCallback((swrKey: string | ((key: string) => boolean), ...args) => {
|
|
if (typeof swrKey === "function") {
|
|
const keys = Array.from(cache.keys()).filter(swrKey);
|
|
keys.forEach((key) => mutate(key, ...args));
|
|
} else {
|
|
mutate(swrKey, ...args);
|
|
}
|
|
}, []) as typeof mutate;
|
|
};
|
|
|
|
export default useGlobalMutation;
|