feat: add quiet reading with rare confirmations
Part of the quiet-user-feedback change; docs and specs land in their own repositories.
This commit is contained in:
@@ -10,12 +10,14 @@ function useStocksPageVm() {
|
||||
const search = useInstrumentSearch(MIN_STOCK_SEARCH_LENGTH);
|
||||
const { canSearch, debounced, isWaiting, query } = search;
|
||||
const result = useStockSearch(debounced);
|
||||
const sync = useScreenSync({ query: debounced, screen: "stocks" }, [result]);
|
||||
useScreenSync({ query: debounced, screen: "stocks" }, [result]);
|
||||
|
||||
return {
|
||||
canSearch,
|
||||
code: apiErrorCode(result.error),
|
||||
error: result.isError || sync.sourceError || sync.transportError,
|
||||
error:
|
||||
!result.data
|
||||
&& (result.isError || result.meta?.sync.state === "failed"),
|
||||
items:
|
||||
result.data?.map(stock => ({
|
||||
...stock,
|
||||
@@ -35,10 +37,6 @@ function useStocksPageVm() {
|
||||
debounced.length >= MIN_STOCK_SEARCH_LENGTH
|
||||
&& !isWaiting
|
||||
&& Boolean(result.data),
|
||||
refreshing: sync.refreshing,
|
||||
retry: () => {
|
||||
void sync.retry();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user