Skip to content

Commit

Permalink
Code rabbit
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Nov 14, 2024
1 parent 33e6c56 commit ccfc118
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/loot-core/src/client/data-hooks/schedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type UseSchedulesResult = ScheduleData & {
export function useSchedules({
query,
}: UseSchedulesProps = {}): UseSchedulesResult {
const [isLoading, setIsLoading] = useState(query != null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<Error | undefined>(undefined);
const [data, setData] = useState<ScheduleData>({
schedules: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/client/data-hooks/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useTransactions({
query,
options = { pageCount: 50 },
}: UseTransactionsProps): UseTransactionsResult {
const [isLoading, setIsLoading] = useState(query != null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<Error | undefined>(undefined);
const [transactions, setTransactions] = useState<
ReadonlyArray<TransactionEntity>
Expand Down
4 changes: 2 additions & 2 deletions packages/loot-core/src/client/query-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export function useQuery<Response = unknown>(
const query = useMemo(makeQuery, dependencies);

const [data, setData] = useState<ReadonlyArray<Response> | null>(null);
const [isLoading, setIsLoading] = useState(query != null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<Error | undefined>(undefined);

useEffect(() => {
setError(query === null ? new Error('Query is null') : undefined);
setIsLoading(query !== null);
setIsLoading(!!query);

if (!query) {
return;
Expand Down

0 comments on commit ccfc118

Please sign in to comment.