mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 18:20:24 -05:00
Use isPending instead of isFetching
This commit is contained in:
@@ -94,9 +94,9 @@ function SelectedBalance({ selectedItems, account }: SelectedBalanceProps) {
|
|||||||
|
|
||||||
let scheduleBalance = 0;
|
let scheduleBalance = 0;
|
||||||
|
|
||||||
const { data: schedules = [], isFetching } = useCachedSchedules();
|
const { data: schedules = [], isPending } = useCachedSchedules();
|
||||||
|
|
||||||
if (isFetching) {
|
if (isPending) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ export function MobileSchedulesPage() {
|
|||||||
const format = useFormat();
|
const format = useFormat();
|
||||||
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
|
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
|
||||||
|
|
||||||
const { isFetching: isSchedulesLoading, data: schedules = [] } = useSchedules(
|
const { isPending: isSchedulesLoading, data: schedules = [] } = useSchedules({
|
||||||
{ query: q('schedules').select('*') },
|
query: q('schedules').select('*'),
|
||||||
);
|
});
|
||||||
const { data: { statusLookup = {} } = {} } = useScheduleStatus({ schedules });
|
const { data: { statusLookup = {} } = {} } = useScheduleStatus({ schedules });
|
||||||
|
|
||||||
const payees = usePayees();
|
const payees = usePayees();
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ type PayeeIconsProps = {
|
|||||||
|
|
||||||
function PayeeIcons({ transaction, transferAccount }: PayeeIconsProps) {
|
function PayeeIcons({ transaction, transferAccount }: PayeeIconsProps) {
|
||||||
const { id, schedule: scheduleId } = transaction;
|
const { id, schedule: scheduleId } = transaction;
|
||||||
const { isFetching: isSchedulesLoading, data: schedules = [] } =
|
const { isPending: isSchedulesLoading, data: schedules = [] } =
|
||||||
useCachedSchedules();
|
useCachedSchedules();
|
||||||
const isPreview = isPreviewId(id);
|
const isPreview = isPreviewId(id);
|
||||||
const schedule = schedules.find(s => s.id === scheduleId);
|
const schedule = schedules.find(s => s.id === scheduleId);
|
||||||
|
|||||||
@@ -44,11 +44,9 @@ export function ScheduledTransactionMenuModal({
|
|||||||
borderTop: `1px solid ${theme.pillBorder}`,
|
borderTop: `1px solid ${theme.pillBorder}`,
|
||||||
};
|
};
|
||||||
const scheduleId = transactionId?.split('/')?.[1];
|
const scheduleId = transactionId?.split('/')?.[1];
|
||||||
const { isFetching: isSchedulesLoading, data: schedules = [] } = useSchedules(
|
const { isPending: isSchedulesLoading, data: schedules = [] } = useSchedules({
|
||||||
{
|
query: q('schedules').filter({ id: scheduleId }).select('*'),
|
||||||
query: q('schedules').filter({ id: scheduleId }).select('*'),
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isSchedulesLoading) {
|
if (isSchedulesLoading) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -363,9 +363,9 @@ function ScheduleDescription({ id }) {
|
|||||||
const { isNarrowWidth } = useResponsive();
|
const { isNarrowWidth } = useResponsive();
|
||||||
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
|
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
|
||||||
const format = useFormat();
|
const format = useFormat();
|
||||||
const { data: schedules = [], isFetching: isSchedulesLoading } = useSchedules(
|
const { data: schedules = [], isPending: isSchedulesLoading } = useSchedules({
|
||||||
{ query: q('schedules').filter({ id }).select('*') },
|
query: q('schedules').filter({ id }).select('*'),
|
||||||
);
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: { statusLookup = {} },
|
data: { statusLookup = {} },
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ export function ScheduleValue({ value }: ScheduleValueProps) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const payees = usePayees();
|
const payees = usePayees();
|
||||||
const byId = getPayeesById(payees);
|
const byId = getPayeesById(payees);
|
||||||
const { data: schedules = [], isFetching } = useSchedules({
|
const { data: schedules = [], isPending } = useSchedules({
|
||||||
query: q('schedules').select('*'),
|
query: q('schedules').select('*'),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isFetching) {
|
if (isPending) {
|
||||||
return (
|
return (
|
||||||
<View aria-label={t('Loading...')} style={{ display: 'inline-flex' }}>
|
<View aria-label={t('Loading...')} style={{ display: 'inline-flex' }}>
|
||||||
<AnimatedLoading width={10} height={10} />
|
<AnimatedLoading width={10} height={10} />
|
||||||
|
|||||||
@@ -41,11 +41,9 @@ export function ScheduleLink({
|
|||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [filter, setFilter] = useState(accountName || '');
|
const [filter, setFilter] = useState(accountName || '');
|
||||||
const { isFetching: isSchedulesLoading, data: schedules = [] } = useSchedules(
|
const { isPending: isSchedulesLoading, data: schedules = [] } = useSchedules({
|
||||||
{
|
query: q('schedules').filter({ completed: false }).select('*'),
|
||||||
query: q('schedules').filter({ completed: false }).select('*'),
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: { statusLookup = {} },
|
data: { statusLookup = {} },
|
||||||
|
|||||||
@@ -764,9 +764,9 @@ function PayeeIcons({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const scheduleId = transaction.schedule;
|
const scheduleId = transaction.schedule;
|
||||||
const { isFetching, data: schedules = [] } = useCachedSchedules();
|
const { isPending, data: schedules = [] } = useCachedSchedules();
|
||||||
|
|
||||||
if (isFetching) {
|
if (isPending) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export function usePreviewTransactions({
|
|||||||
TransactionEntity[]
|
TransactionEntity[]
|
||||||
>([]);
|
>([]);
|
||||||
const {
|
const {
|
||||||
isFetching: isSchedulesLoading,
|
isPending: isSchedulesLoading,
|
||||||
error: scheduleQueryError,
|
error: scheduleQueryError,
|
||||||
data: schedules = [],
|
data: schedules = [],
|
||||||
} = useCachedSchedules();
|
} = useCachedSchedules();
|
||||||
|
|||||||
Reference in New Issue
Block a user