Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(manage): catch errors when fail to load state
  • Loading branch information
dtfiedler committed Aug 8, 2025
commit 3ad7972fca80ae80dacbac3bf1f3a84b766888c8
1 change: 1 addition & 0 deletions src/components/data-display/tables/DomainsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const DomainsTable = ({

Object.entries(domainData.names).map(([domain, record]) => {
const ant = domainData.ants[record.processId];
console.log(domainData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(domainData);

const data: TableData = {
openRow: <></>,
name: domain,
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Manage/Manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Manage() {
walletAddress &&
antsRequireUpdate.length > 0 && (
<Tooltip
message={`${antsRequireUpdate.length} domains are eligible for an update`}
message={`${antsRequireUpdate.length} ANTs are eligible for an update`}
icon={
<button
onClick={() =>
Expand Down
21 changes: 13 additions & 8 deletions src/hooks/useAntsForWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useAntsForWallet = (): UseQueryResult<
const { data: antVersions = {} } = useANTVersions();
const { data: latestAntVersion } = useLatestANTVersion();
return useQuery({
queryKey: ['ants', walletAddress?.toString()],
queryKey: ['ants-with-metadata', walletAddress?.toString()],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyperbeamUrl, aoNetwork.ANT, accessControlList, antVersions should be added to the query key so that if they are updated the data is reevaluated. Main concern there is accessControlList

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And actually doesn't look like we need wallet address here. Fine to have it, but it doesn't affect the query.

queryFn: async () => {
const antAo = connect(aoNetwork.ANT);
const uniqueAnts = [
Expand All @@ -35,13 +35,19 @@ export const useAntsForWallet = (): UseQueryResult<
const antsWithMetadata = await Promise.all(
uniqueAnts.map(async (processId) => {
const [state, processMeta] = await Promise.all([
queryClient.fetchQuery(
buildAntStateQuery({
processId,
ao: antAo,
hyperbeamUrl: hyperbeamUrl,
queryClient
.fetchQuery(
buildAntStateQuery({
processId,
ao: antAo,
hyperbeamUrl: hyperbeamUrl,
}),
)
.catch((e) => {
console.error(e);
return undefined;
}),
),
// TODO: send these in a single request
queryClient
.fetchQuery(
buildGraphQLQuery(aoNetwork.ANT.GRAPHQL_URL, {
Expand All @@ -54,7 +60,6 @@ export const useAntsForWallet = (): UseQueryResult<
return null;
}),
]);

const moduleId = processMeta?.tags.find(
(tag) => tag.name === 'Module',
)?.value;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function buildAntStateQuery({
hyperbeamUrl?: string;
}): {
queryKey: ['ant', string] | string[];
queryFn: () => Promise<AoANTState | null>;
queryFn: () => Promise<AoANTState | undefined>;
staleTime: number;
} {
return {
Expand All @@ -68,7 +68,7 @@ export function buildAntStateQuery({
process: new AOProcess({ processId, ao }),
hyperbeamUrl,
});
return await ant.getState();
return ant.getState();
},
staleTime: Infinity,
};
Expand Down
Loading