1969735e961d

fix: mDNS onCleanup registered synchronously before dynamic import to avoid SolidJS owner capture miss (v3.6.101)

time
2026-05-22 18:34 UTC · 5 months ago
machine
koh2
parent
7c09d257bea1
1 file src/popup/App.tsx+6 −6
src/popup/App.tsx+6 −6
@@ -513,13 +513,13 @@513513         }514514       });515515 516-      // mDNS peer-discovery trigger. The native SyncPlugin emits517-      // `peerDiscovered` when it resolves a known paired device on the LAN;518-      // the listener fires TRIGGER_SYNC with reason "mdns". Graceful no-op519-      // if the plugin doesn't expose the event yet.516+      // mDNS peer-discovery trigger. Register onCleanup synchronously so517+      // SolidJS captures it within the reactive owner — onCleanup inside a518+      // .then() callback may miss the capture window and leak the listener.519+      let stopMDNS: () => void = () => undefined;520+      onCleanup(() => stopMDNS());520521       void import("./chirp-pair-capacitor").then(({ startMDNSListener }) => {521-        const stop = startMDNSListener();522-        onCleanup(stop);522+        stopMDNS = startMDNSListener();523523       });524524     }525525 

view file