mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
Merge pull request #657 from bigcapitalhq/suspense-lazy-banking-pages
fix: Suspense the lazy loaded components in banking pages
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { Suspense, lazy } from 'react';
|
||||||
|
import { Spinner } from '@blueprintjs/core';
|
||||||
|
import { AppContentShell } from '@/components/AppShell';
|
||||||
|
|
||||||
|
const CategorizeTransactionAside = lazy(() =>
|
||||||
|
import('../CategorizeTransactionAside/CategorizeTransactionAside').then(
|
||||||
|
(module) => ({ default: module.CategorizeTransactionAside }),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
export function AccountTransactionsAside() {
|
||||||
|
return (
|
||||||
|
<AppContentShell.Aside>
|
||||||
|
<Suspense fallback={<Spinner size={20} />}>
|
||||||
|
<CategorizeTransactionAside />
|
||||||
|
</Suspense>
|
||||||
|
</AppContentShell.Aside>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React, { Suspense } from 'react';
|
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { Spinner } from '@blueprintjs/core';
|
import { Spinner } from '@blueprintjs/core';
|
||||||
|
import { Suspense, lazy } from 'react';
|
||||||
|
|
||||||
import '@/style/pages/CashFlow/AccountTransactions/List.scss';
|
import '@/style/pages/CashFlow/AccountTransactions/List.scss';
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
import { AccountTransactionsDetailsBar } from './AccountTransactionsDetailsBar';
|
import { AccountTransactionsDetailsBar } from './AccountTransactionsDetailsBar';
|
||||||
import { AccountTransactionsFilterTabs } from './AccountTransactionsFilterTabs';
|
import { AccountTransactionsFilterTabs } from './AccountTransactionsFilterTabs';
|
||||||
import { AppContentShell } from '@/components/AppShell';
|
import { AppContentShell } from '@/components/AppShell';
|
||||||
import { CategorizeTransactionAside } from '../CategorizeTransactionAside/CategorizeTransactionAside';
|
import { AccountTransactionsAside } from './AccountTransactionsAside';
|
||||||
import { AccountTransactionsLoadingBar } from './components';
|
import { AccountTransactionsLoadingBar } from './components';
|
||||||
import { withBanking } from '../withBanking';
|
import { withBanking } from '../withBanking';
|
||||||
|
|
||||||
@@ -56,14 +56,6 @@ function AccountTransactionsMain() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AccountTransactionsAside() {
|
|
||||||
return (
|
|
||||||
<AppContentShell.Aside>
|
|
||||||
<CategorizeTransactionAside />
|
|
||||||
</AppContentShell.Aside>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default R.compose(
|
export default R.compose(
|
||||||
withBanking(
|
withBanking(
|
||||||
({ selectedUncategorizedTransactionId, openMatchingTransactionAside }) => ({
|
({ selectedUncategorizedTransactionId, openMatchingTransactionAside }) => ({
|
||||||
@@ -73,11 +65,8 @@ export default R.compose(
|
|||||||
),
|
),
|
||||||
)(AccountTransactionsListRoot);
|
)(AccountTransactionsListRoot);
|
||||||
|
|
||||||
const AccountsTransactionsAll = React.lazy(
|
const AccountsTransactionsAll = lazy(() => import('./AccountsTransactionsAll'));
|
||||||
() => import('./AccountsTransactionsAll'),
|
const AccountsTransactionsUncategorized = lazy(
|
||||||
);
|
|
||||||
|
|
||||||
const AccountsTransactionsUncategorized = React.lazy(
|
|
||||||
() => import('./AllTransactionsUncategorized'),
|
() => import('./AllTransactionsUncategorized'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import { Suspense } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
import { Spinner } from '@blueprintjs/core';
|
||||||
import { CategorizeTransactionBoot } from './CategorizeTransactionBoot';
|
import { CategorizeTransactionBoot } from './CategorizeTransactionBoot';
|
||||||
import { CategorizeTransactionForm } from './CategorizeTransactionForm';
|
import { CategorizeTransactionForm } from './CategorizeTransactionForm';
|
||||||
import { withBanking } from '@/containers/CashFlow/withBanking';
|
import { withBanking } from '@/containers/CashFlow/withBanking';
|
||||||
@@ -13,7 +15,9 @@ function CategorizeTransactionContentRoot({
|
|||||||
uncategorizedTransactionsIds={transactionsToCategorizeIdsSelected}
|
uncategorizedTransactionsIds={transactionsToCategorizeIdsSelected}
|
||||||
>
|
>
|
||||||
<CategorizeTransactionDrawerBody>
|
<CategorizeTransactionDrawerBody>
|
||||||
<CategorizeTransactionForm />
|
<Suspense fallback={<Spinner size={40} />}>
|
||||||
|
<CategorizeTransactionForm />
|
||||||
|
</Suspense>
|
||||||
</CategorizeTransactionDrawerBody>
|
</CategorizeTransactionDrawerBody>
|
||||||
</CategorizeTransactionBoot>
|
</CategorizeTransactionBoot>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { createContext } from 'react';
|
|||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { useGetBankTransactionsMatches } from '@/hooks/query/bank-rules';
|
import { useGetBankTransactionsMatches } from '@/hooks/query/bank-rules';
|
||||||
|
import { Spinner } from '@blueprintjs/core';
|
||||||
|
|
||||||
interface MatchingTransactionBootValues {
|
interface MatchingTransactionBootValues {
|
||||||
isMatchingTransactionsLoading: boolean;
|
isMatchingTransactionsLoading: boolean;
|
||||||
@@ -52,6 +53,11 @@ function MatchingTransactionBoot({
|
|||||||
matches,
|
matches,
|
||||||
} as MatchingTransactionBootValues;
|
} as MatchingTransactionBootValues;
|
||||||
|
|
||||||
|
const isLoading = isMatchingTransactionsLoading;
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <Spinner size={40} />;
|
||||||
|
}
|
||||||
return <RuleFormBootContext.Provider value={provider} {...props} />;
|
return <RuleFormBootContext.Provider value={provider} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user