Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

fix(editor): drop the local edits override when the screenshot prop changes

Luis Ortiz016a19c50e62
diff --git a/src/ui/shared/ScreenshotView.tsx b/src/ui/shared/ScreenshotView.tsx
index 0a80c55..7d9b0b4 100644
--- a/src/ui/shared/ScreenshotView.tsx
+++ b/src/ui/shared/ScreenshotView.tsx
@@ -86,6 +86,7 @@ export default function ScreenshotView({
const processedKeyRef = useRef<string | null>(null);
const urlRef = useRef<string | null>(null);
const idRef = useRef(screenshot.id);
+ const propEditsRef = useRef(screenshot.edits);
const saveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const savedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const dragRef = useRef<DragState | null>(null);
@@ -104,6 +105,13 @@ export default function ScreenshotView({
}
}, [screenshot.id]);
+ useEffect(() => {
+ if (propEditsRef.current !== screenshot.edits) {
+ propEditsRef.current = screenshot.edits;
+ setEditsOverride(undefined);
+ }
+ }, [screenshot.edits]);
+
useEffect(() => {
setAltDraft(effectiveEdits?.alt ?? '');
}, [effectiveEdits?.alt]);