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: guide-me sidepanel sync β€” listen for session start + clear stale sessions on restart

Luis Ortizb11964c8bed9
diff --git a/src/entrypoints/background/index.ts b/src/entrypoints/background/index.ts
index 57689e1..5ab6fae 100644
--- a/src/entrypoints/background/index.ts
+++ b/src/entrypoints/background/index.ts
@@ -53,6 +53,7 @@ export default defineBackground(() => {
setSidePanelBehavior(true);
initActor().catch(initActorFallback);
+ cancelSession();
registerNavigationListeners();
setupPortListener((port) => {
diff --git a/src/ui/sidepanel/App.tsx b/src/ui/sidepanel/App.tsx
index 88e7029..6cad367 100644
--- a/src/ui/sidepanel/App.tsx
+++ b/src/ui/sidepanel/App.tsx
@@ -103,6 +103,17 @@ export default function App() {
setView({ name: 'guideme', guideId: session.guideId });
}
});
+
+ const handler = (changes: Record<string, { newValue?: unknown }>) => {
+ if (!changes[SESSION_KEY]) return;
+ const session = changes[SESSION_KEY].newValue as GuideMeSession | null;
+ if (session?.active) {
+ setView({ name: 'guideme', guideId: session.guideId });
+ }
+ };
+
+ browser.storage.local.onChanged.addListener(handler);
+ return () => browser.storage.local.onChanged.removeListener(handler);
}, []);
const handleStartRecording = useCallback(async () => {