27 lines
819 B
TypeScript
27 lines
819 B
TypeScript
/**
|
|
* Capture for the refresh hooks.
|
|
*
|
|
* tests/setup.ts mocks common-ui/hooks/useManualRefresh and useMarkDataFetchers.
|
|
* Their real implementations need a navigation container and are irrelevant to
|
|
* most assertions, but the home page funnels its pull-to-refresh through them.
|
|
* The mocks record the latest callback here so a test can invoke the page's
|
|
* handleRefresh directly.
|
|
*
|
|
* The callbacks are re-registered on every render, so read them only after the
|
|
* page has mounted.
|
|
*/
|
|
|
|
export interface RefreshHooks {
|
|
manualRefresh: (() => void) | null
|
|
markDataFetchers: (() => void) | null
|
|
}
|
|
|
|
export const refreshHooks: RefreshHooks = {
|
|
manualRefresh: null,
|
|
markDataFetchers: null,
|
|
}
|
|
|
|
export function resetRefreshHooks() {
|
|
refreshHooks.manualRefresh = null
|
|
refreshHooks.markDataFetchers = null
|
|
}
|