Skip to content

Commit 71326a5

Browse files
committed
Update DataState to use ErrorWithRefetch by default, instead of ErrorIndicator
1 parent eebe613 commit 71326a5

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

src/components/common/indicators/error-with-refetch.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ export default function ErrorWithRefetch(props: {
88
className?: string
99
}) {
1010
return (
11-
<span>
11+
<span className={props.className}>
1212
<ErrorIndicator
13-
className={props.className}
1413
error={props.error}
1514
/>
1615
<RefetchIndicator refetch={props.refetch} />

src/components/content/home-page/blocks/block.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export default function Block(props: {
4747
<span className='text-sm text-(--grey-fg-color)'>
4848
<blockData.Render
4949
value={() => `(${getBlockAgeFromSecs(getSecsFromUnixSecs(blockData.value!.timestamp))} ago)`}
50-
errorFallback={<ErrorWithRefetch refetch={blockData.fetch} />}
5150
className='w-[6em]'
5251
/>
5352
</span>
@@ -63,7 +62,6 @@ export default function Block(props: {
6362
<span className='px-2 md:px-4 leading-5'>
6463
<blockData.Render
6564
value={() => `${blockData.value!.transactions.length} transactions`}
66-
errorFallback={<ErrorWithRefetch refetch={blockData.fetch} />}
6765
className='text-(--grey-fg-color) w-[8rem]'
6866
/>
6967
</span>
@@ -82,7 +80,6 @@ export default function Block(props: {
8280
popover={blockData.value!.miner}
8381
className='left-[-37%] top-[-2.6rem] w-78 py-1.5 px-2.5'
8482
/>}
85-
errorFallback={<ErrorWithRefetch refetch={blockData.fetch} />}
8683
className='text-(--link-color) w-[11rem]'
8784
/>
8885
</span>

src/components/content/home-page/stats/stat-card.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default function StatCard<T>(props: {
2424
<div className='pl-12'>
2525
<props.dataState.Render
2626
value={props.value}
27-
errorFallback={<ErrorWithRefetch refetch={props.dataState.fetch} />}
2827
loading='Loading ...'
2928
/>
3029
</div>

src/lib/data-state.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Dispatch, ReactNode, SetStateAction, useCallback, useEffect, useMemo, u
22
import ErrorIndicator from '@/components/common/indicators/error-indicator';
33
import LoadingPulse from '@/components/common/indicators/loading-pulse';
44
import LoadingIndicator from '@/components/common/indicators/loading-indicator';
5+
import ErrorWithRefetch from '@/components/common/indicators/error-with-refetch';
56

67

78
type ValueRoot<T> = {
@@ -176,7 +177,7 @@ export const DataState = {
176177
}
177178
else if (dataRoot.error) {
178179
if (showFallback) {
179-
return errorFallback ?? <ErrorIndicator error={error} className={className} />;
180+
return errorFallback ?? <ErrorWithRefetch refetch={fetch} error={error} className={className} />;
180181
}
181182
}
182183
else if (showFallback) {

0 commit comments

Comments
 (0)