Skip to content

Commit

Permalink
fix(loading): update loading of assets
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusofsparta committed Dec 9, 2024
1 parent ca7739c commit 5d0451b
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 114 deletions.
14 changes: 6 additions & 8 deletions src/components/data-display/tables/DomainsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type TableData = {
supported: number;
};
expiryDate: string;
handlers: AoANTHandler[];
handlers: AoANTHandler[] | null;
status: string | number;
action: ReactNode;
} & Record<string, any>;
Expand Down Expand Up @@ -102,7 +102,10 @@ const DomainsTable = ({
}: {
domainData: {
names: Record<string, AoArNSNameData>;
ants: Record<string, { state: AoANTState; handlers: AoANTHandler[] }>;
ants: Record<
string,
{ state: AoANTState | null; handlers: AoANTHandler[] | null }
>;
};
loading: boolean;
filter?: string;
Expand All @@ -129,11 +132,6 @@ const DomainsTable = ({
}, [searchParams]);

useEffect(() => {
// if (loading) {
// setTableData([]);
// setFilteredTableData([]);
// return;
// }
if (domainData) {
const newTableData: TableData[] = [];

Expand Down Expand Up @@ -186,7 +184,7 @@ const DomainsTable = ({

setTableData(newTableData);
}
}, [domainData, loading, primaryNameData]);
}, [domainData.names, loading, primaryNameData]);

useEffect(() => {
if (filter) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/data-display/tables/UndernamesSubtable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const UndernamesSubtable = ({
}: {
undernames: Record<string, AoANTRecord>;
arnsDomain: string;
handlers?: AoANTHandler[];
handlers?: AoANTHandler[] | null;
antId: string;
}) => {
const [{ gateway, ioProcessId }] = useGlobalState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export function createUpdateAntsNotification({
ants,
userAddress,
}: {
ants: Record<string, { state: AoANTState; handlers: AoANTHandler[] }>;
ants: Record<
string,
{ state: AoANTState | null; handlers: AoANTHandler[] | null }
>;
userAddress: string;
}): Notification | undefined {
const antsRequiringUpdate = getAntsRequiringUpdate({
Expand Down Expand Up @@ -83,7 +86,10 @@ export function createNamesExceedingUndernameLimitNotification({
ants,
}: {
domains: Record<string, AoArNSNameData>;
ants: Record<string, { state: AoANTState; handlers: AoANTHandler[] }>;
ants: Record<
string,
{ state: AoANTState | null; handlers: AoANTHandler[] | null }
>;
}): Notification | undefined {
const domainsRequiringUndernameSupportUpgrade = Object.values(domains).reduce(
(acc: number, record: AoArNSNameData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function ReturnNameModal({
const queryClient = useQueryClient();
const navigate = useNavigate();
const [{ ioProcessId }] = useGlobalState();
const [{ arnsEmitter }, dispatchArNSState] = useArNSState();
const [, dispatchArNSState] = useArNSState();
const [{ signing }, dispatchTransactionState] = useTransactionState();
const [{ wallet, walletAddress }] = useWalletState();

Expand Down Expand Up @@ -86,7 +86,6 @@ export function ReturnNameModal({
walletAddress: walletAddress,
ioProcessId,
dispatch: dispatchArNSState,
emitter: arnsEmitter,
});
setShow(false);
navigate('/manage');
Expand Down
7 changes: 2 additions & 5 deletions src/components/pages/Manage/Manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import './styles.css';

function Manage() {
const [{ ioProcessId }] = useGlobalState();
const [
{ loading: loadingArnsState, domains, ants, arnsEmitter },
dispatchArNSState,
] = useArNSState();
const [{ loading: loadingArnsState, domains, ants }, dispatchArNSState] =
useArNSState();
const [{ walletAddress }] = useWalletState();
const [, dispatchModalState] = useModalState();
const [search, setSearch] = useState<string>('');
Expand Down Expand Up @@ -94,7 +92,6 @@ function Manage() {
onClick={() =>
walletAddress
? dispatchArNSUpdate({
emitter: arnsEmitter,
dispatch: dispatchArNSState,
walletAddress: walletAddress,
ioProcessId,
Expand Down
3 changes: 1 addition & 2 deletions src/components/pages/Transaction/TransactionReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function TransactionReview() {
const navigate = useNavigate();
const [{ ioTicker, arioContract, ioProcessId, aoNetwork, aoClient }] =
useGlobalState();
const [{ arnsEmitter }, dispatchArNSState] = useArNSState();
const [, dispatchArNSState] = useArNSState();
const [{ walletAddress, wallet }] = useWalletState();
const [
{ workflowName, interactionType, transactionData, interactionResult },
Expand Down Expand Up @@ -128,7 +128,6 @@ function TransactionReview() {
} finally {
if (walletAddress) {
dispatchArNSUpdate({
emitter: arnsEmitter,
dispatch: dispatchArNSState,
ioProcessId,
walletAddress,
Expand Down
Loading

0 comments on commit 5d0451b

Please sign in to comment.