Skip to content

🙌 OpenHands: AI-Driven Development

fix(hooks): use dedicated hooks fetch error message in available hooks dialog (#18177)

Liang Xu2955e7c5e84c
diff --git a/__tests__/components/features/conversation-panel/hooks-modal.test.tsx b/__tests__/components/features/conversation-panel/hooks-modal.test.tsx
index 5d6d849892..9b16c7a418 100644
--- a/__tests__/components/features/conversation-panel/hooks-modal.test.tsx
+++ b/__tests__/components/features/conversation-panel/hooks-modal.test.tsx
@@ -34,7 +34,9 @@ vi.mock("react-i18next", async () => {
HOOKS_MODAL$TYPE: `Type: ${params?.type ?? ""}`,
HOOKS_MODAL$TIMEOUT: `Timeout: ${params?.timeout ?? 0}s`,
HOOKS_MODAL$ASYNC: "Async",
- COMMON$FETCH_ERROR: "Failed to fetch data",
+ HOOKS_MODAL$FETCH_ERROR:
+ "Failed to fetch hooks. Please try again later.",
+ COMMON$FETCH_ERROR: "Failed to fetch skills. Please try again later.",
CONVERSATION$NO_HOOKS: "No hooks configured",
BUTTON$REFRESH: "Refresh",
BUTTON$CLOSE: "Close",
@@ -64,7 +66,10 @@ describe("HooksEmptyState", () => {
it("should render error message when isError is true", () => {
render(<HooksEmptyState isError={true} />);
- expect(screen.getByText("Failed to fetch data")).toBeInTheDocument();
+ expect(
+ screen.getByText("Failed to fetch hooks. Please try again later."),
+ ).toBeInTheDocument();
+ expect(screen.queryByText(/skills/i)).not.toBeInTheDocument();
});
});
diff --git a/src/components/features/conversation-panel/hooks-empty-state.tsx b/src/components/features/conversation-panel/hooks-empty-state.tsx
index 735c7c5d7c..84a02fdc89 100644
--- a/src/components/features/conversation-panel/hooks-empty-state.tsx
+++ b/src/components/features/conversation-panel/hooks-empty-state.tsx
@@ -13,7 +13,7 @@ export function HooksEmptyState({ isError }: HooksEmptyStateProps) {
<div className="flex items-center justify-center h-full p-4">
<Typography.Text className="text-muted">
{isError
- ? t(I18nKey.COMMON$FETCH_ERROR)
+ ? t(I18nKey.HOOKS_MODAL$FETCH_ERROR)
: t(I18nKey.CONVERSATION$NO_HOOKS)}
</Typography.Text>
</div>
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 0fd523d261..e77e1dded4 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -30123,6 +30123,23 @@
"uk": "Зупинка",
"ca": "Atura"
},
+ "HOOKS_MODAL$FETCH_ERROR": {
+ "en": "Failed to fetch hooks. Please try again later.",
+ "ja": "フックの取得に失敗しました。後でもう一度お試しください。",
+ "zh-CN": "获取钩子失败。请稍后再试。",
+ "zh-TW": "取得鉤子失敗。請稍後再試。",
+ "ko-KR": "훅을 가져오지 못했습니다. 나중에 다시 시도해주세요.",
+ "no": "Kunne ikke hente kroker. Prøv igjen senere.",
+ "ar": "فشل في جلب الخطافات. يرجى المحاولة لاحقًا.",
+ "de": "Die Hooks konnten nicht abgerufen werden. Bitte versuchen Sie es später erneut.",
+ "fr": "Échec de la récupération des hooks. Veuillez réessayer plus tard.",
+ "it": "Impossibile recuperare gli hook. Riprova più tardi.",
+ "pt": "Falha ao buscar os hooks. Por favor, tente novamente mais tarde.",
+ "es": "No se pudieron obtener los hooks. Por favor, inténtalo de nuevo más tarde.",
+ "tr": "Kancalar alınamadı. Lütfen daha sonra tekrar deneyin.",
+ "uk": "Не вдалося отримати хуки. Будь ласка, спробуйте пізніше.",
+ "ca": "No s'han pogut obtenir els hooks. Torneu-ho a intentar més tard."
+ },
"HOOK$HOOK_LABEL": {
"en": "Hook",
"ja": "フック",