-
Joel Jeremy Marquez authored
* Typescript migration * Release notes * Update error boundary * Breakup sidebar components * Account and Sidebar props * Remove button in Item component + exports cleanup * Put accountNameStyle to Account * Revert component ports (separated to another PR) * Export cleanup * Remove ErrorBoundary (separated to another PR) * Sidebar budgetName as ReactNode
Joel Jeremy Marquez authored* Typescript migration * Release notes * Update error boundary * Breakup sidebar components * Account and Sidebar props * Remove button in Item component + exports cleanup * Put accountNameStyle to Account * Revert component ports (separated to another PR) * Export cleanup * Remove ErrorBoundary (separated to another PR) * Sidebar budgetName as ReactNode
SyncRefresh.tsx 534 B
import { type ReactNode, useState } from 'react';
type ChildrenProps = {
refreshing: boolean;
onRefresh: () => Promise<void>;
};
type SyncRefreshProps = {
onSync: () => Promise<void>;
children: (props: ChildrenProps) => ReactNode;
};
export default function SyncRefresh({ onSync, children }: SyncRefreshProps) {
let [syncing, setSyncing] = useState(false);
async function onSync_() {
setSyncing(true);
await onSync();
setSyncing(false);
}
return children({ refreshing: syncing, onRefresh: onSync_ });
}