Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Dub review: a saved edit is in the cache at once, so a review reopened before the server answers shows it

Claude2836734fc4ef
diff --git a/src/components/dub/hooks.ts b/src/components/dub/hooks.ts
index 63f750a6..52e21bf5 100644
--- a/src/components/dub/hooks.ts
+++ b/src/components/dub/hooks.ts
@@ -91,6 +91,11 @@ export function useDubActions() {
const saveDraft = useMutation({
mutationFn: async ({ id, lang, cues }: { id: string; lang: string; cues: Cue[] }) =>
json<DubSessionView>(await fetch(`/api/dub/${id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ lang, cues }) })),
+ // The edit is in the cache at once: a review reopened before the server answers shows it (and doesn't save over it).
+ onMutate: async ({ id, lang, cues }) => {
+ await qc.cancelQueries({ queryKey: ["dub"] });
+ qc.setQueryData<DubSessionView[]>(["dub"], (xs) => xs?.map((x) => (x.id === id ? { ...x, drafts: { ...x.drafts, [lang]: cues } } : x)));
+ },
onSuccess: put,
});
const voice = useMutation({