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:
committed by
Teknium
parent
ee502e5640
commit
00d25595c1
@@ -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)) =>
|
||||
|
||||
Reference in New Issue
Block a user