(selector)
| 140 | * ``` |
| 141 | */ |
| 142 | export 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. |
no test coverage detected