Skip to content

Commit 7a1a1ce

Browse files
committed
revalidate error catching
1 parent 39d6908 commit 7a1a1ce

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/app/screens/Feed/components/RevalidateCacheButton.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@ export default function RevalidateCacheButton({
2020

2121
const handleClick = (): void => {
2222
setResult(null);
23+
2324
startTransition(async () => {
24-
const res = await revalidateFeedCache(feedId);
25-
setResult(res);
25+
try {
26+
const res = await revalidateFeedCache(feedId);
27+
setResult(res);
28+
} catch {
29+
setResult({
30+
ok: false,
31+
message: 'Failed to revalidate the cache. Please try again.',
32+
});
33+
}
2634
});
2735
};
2836

0 commit comments

Comments
 (0)