perf(ui-tui): narrow overlay subscriptions to focused selectors

Subscribe overlay components to computed theme/session selectors instead of the full UI store so unrelated UI state updates trigger fewer overlay renders.
This commit is contained in:
Brooklyn Nicholson 2026-05-05 15:30:27 -05:00 committed by Teknium
parent ee502e5640
commit 00d25595c1
2 changed files with 27 additions and 23 deletions

View file

@ -1,4 +1,4 @@
import { atom } from 'nanostores'
import { atom, computed } from 'nanostores'
import { MOUSE_TRACKING } from '../config/env.js'
import { ZERO } from '../domain/usage.js'
@ -30,6 +30,9 @@ const buildUiState = (): UiState => ({
export const $uiState = atom<UiState>(buildUiState())
export const $uiTheme = computed($uiState, state => state.theme)
export const $uiSessionId = computed($uiState, state => state.sid)
export const getUiState = () => $uiState.get()
export const patchUiState = (next: Partial<UiState> | ((state: UiState) => UiState)) =>