RecentlyViewedDashboards: Retry when error (#115649)

This commit is contained in:
Yunwen Zheng
2025-12-23 09:14:00 -05:00
committed by GitHub
parent ac866b0114
commit 359505a8aa
2 changed files with 15 additions and 1 deletions
@@ -25,6 +25,7 @@ export function RecentlyViewedDashboards() {
value: recentDashboards = [],
loading,
retry,
error,
} = useAsyncRetry(async () => {
if (!evaluateBooleanFlag('recentlyViewedDashboards', false)) {
return [];
@@ -62,7 +63,18 @@ export function RecentlyViewedDashboards() {
className={styles.title}
contentClassName={styles.content}
>
{/* placeholder */}
{error && (
<>
<Text color="secondary">
<Trans i18nKey="browse-dashboards.recently-viewed.error">
Recently viewed dashboards couldn’t be loaded.
</Trans>
</Text>
<Button onClick={retry} size="xs" fill="text">
{t('browse-dashboards.recently-viewed.retry', 'Retry')}
</Button>
</>
)}
{loading && <Spinner />}
{/* TODO: Better empty state https://github.com/grafana/grafana/issues/114804 */}
{!loading && recentDashboards.length === 0 && (
+2
View File
@@ -3748,6 +3748,8 @@
"recently-viewed": {
"clear": "Clear history",
"empty": "Nothing viewed yet",
"error": "Recently viewed dashboards couldn’t be loaded.",
"retry": "Retry",
"title": "Recently viewed"
},
"restore": {