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