mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 09:19:34 +05:30
destroy() previously only called canvas.destroy(), leaking: - the container keydown listener - the insertBtn click listener - the debouncedPreview setTimeout handle (could write to a detached <pre>) - the debouncedPersist setTimeout handle (could writeFile after unmount) - the store.subscribe listener (store kept a stale closure) Also compute the persistence path once on mount instead of invoking getUserDataPath() three times per panel lifecycle. Inline debouncedPreview / debouncedPersist so their timer handles are reachable from destroy(). Capture store.subscribe's unsubscribe. destroy() order: clear timers, unsubscribe store, remove listeners, then canvas.destroy(). Amit Haridas