fix(reference): show the result count only for a settled list (08-09)

The count status said "checking results" next to a failure alert, and the
sample judged the state from `data` instead of `state.base`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-26 01:06:43 +09:00
co-authored by Claude Opus 5.5
parent dbe6b769bf
commit 9d61eacdc7
3 changed files with 46 additions and 8 deletions
@@ -14,7 +14,6 @@ export const REFERENCE_MESSAGE_CATALOGS = Object.freeze({
"reference.list.create": "새 항목 만들기",
"reference.list.refresh": "새로고침",
"reference.list.resultCount": "총 {count}개 항목",
"reference.list.resultPending": "결과 확인 중",
"reference.form.back": "목록으로 돌아가기",
"reference.form.title": "Reference resource 만들기",
"reference.form.description":
@@ -60,7 +59,6 @@ export const REFERENCE_MESSAGE_CATALOGS = Object.freeze({
"reference.list.create": "Create item",
"reference.list.refresh": "Refresh",
"reference.list.resultCount": "Total items: {count}",
"reference.list.resultPending": "Checking results",
"reference.form.back": "Back to the list",
"reference.form.title": "Create a reference resource",
"reference.form.description":
@@ -44,13 +44,14 @@ export default function ReferenceResourcePage() {
</Button>
}
resultCount={
query.data
? // Feature keys carry no parameter types, so the count goes
// through the untyped resolver.
resolveMessage(locale, "reference.list.resultCount", {
count: query.data.length,
// 08-09. Counted only from a settled result: a loading, idle or
// failed list has nothing to count. Feature keys carry no parameter
// types, so the count goes through the untyped resolver.
query.state.base === "success" || query.state.base === "empty"
? resolveMessage(locale, "reference.list.resultCount", {
count: query.data?.length ?? 0,
})
: message("reference.list.resultPending")
: null
}
>
<AsyncSurface