@@ -144,8 +150,19 @@ export function TablesViewer({
))
) : (
-
- No results.
+
+ {isError ? (
+
+ Query error: {error.message}
+
+ ) : (
+ "No results."
+ )}
)}
diff --git a/packages/explorer/src/app/(explorer)/queries/useTableDataQuery.ts b/packages/explorer/src/app/(explorer)/queries/useTableDataQuery.ts
index 32b9621e9e..c4f42886fa 100644
--- a/packages/explorer/src/app/(explorer)/queries/useTableDataQuery.ts
+++ b/packages/explorer/src/app/(explorer)/queries/useTableDataQuery.ts
@@ -37,7 +37,12 @@ export function useTableDataQuery({ table, query }: Props) {
]),
});
- return response.json();
+ const data = await response.json();
+ if (!response.ok) {
+ throw new Error(data.msg || "Network response was not ok");
+ }
+
+ return data;
},
select: (data: DozerResponse) => {
if (!table || !data?.result?.[0]) return;
@@ -58,6 +63,9 @@ export function useTableDataQuery({ table, query }: Props) {
};
},
enabled: !!table && !!query,
- refetchInterval: 1_000,
+ refetchInterval: (query) => {
+ if (query.state.error) return false;
+ return 1000;
+ },
});
}