mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
Replace the `SLIDEOUT_PANEL_OPENED_EVENT` window event with a `slideoutOpenedTickAtom` jotai atom. The dispatcher in `SidebarSlideOutPanel` now bumps the tick via `useSetAtom`, and the listener in `Thread` reads it via `useAtomValue` and reacts on change behind a ref guard that skips the initial render — preserving the one-shot-per-open semantics of the previous event. This removes the implicit cross-module string contract, makes the signal traceable through React DevTools / jotai inspector, and lets TypeScript catch typos that the string-based event API silently swallowed.
9 lines
383 B
TypeScript
9 lines
383 B
TypeScript
import { atom } from "jotai";
|
|
|
|
/**
|
|
* Tick counter that increments each time a sidebar slide-out panel opens.
|
|
* Consumers read this with `useAtomValue` and react to it changing — guard
|
|
* the initial render with a ref so the effect only fires on subsequent
|
|
* opens, matching the one-shot semantics of the previous window event.
|
|
*/
|
|
export const slideoutOpenedTickAtom = atom(0);
|