MCPcopy Index your code
hub / github.com/codeaashu/claude-code / useAppState

Function useAppState

src/state/AppState.tsx:142–163  ·  view source on GitHub ↗
(selector)

Source from the content-addressed store, hash-verified

140 * ```
141 */
142export function useAppState(selector) {
143 const $ = _c(3);
144 const store = useAppStore();
145 let t0;
146 if ($[0] !== selector || $[1] !== store) {
147 t0 = () => {
148 const state = store.getState();
149 const selected = selector(state);
150 if (false && state === selected) {
151 throw new Error(`Your selector in \`useAppState(${selector.toString()})\` returned the original state, which is not allowed. You must instead return a property for optimised rendering.`);
152 }
153 return selected;
154 };
155 $[0] = selector;
156 $[1] = store;
157 $[2] = t0;
158 } else {
159 t0 = $[2];
160 }
161 const get = t0;
162 return useSyncExternalStore(store.subscribe, get, get);
163}
164
165/**
166 * Get the setAppState updater without subscribing to any state.

Callers 15

SessionBackgroundHintFunction · 0.85
CoordinatorTaskPanelFunction · 0.85
useCoordinatorTaskCountFunction · 0.85
StatusLineInnerFunction · 0.85
ModelPickerFunction · 0.85
MessageSelectorFunction · 0.85
BridgeDialogFunction · 0.85
TeammateViewHeaderFunction · 0.85
ThemePickerFunction · 0.85
SpinnerWithVerbFunction · 0.85
SpinnerWithVerbInnerFunction · 0.85
BriefSpinnerFunction · 0.85

Calls 2

useAppStoreFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected