fix(showcase): CRM Workbench KPI cards read adapter.find().data not .records#2632
Merged
Merged
Conversation
…records
The CRM Workbench KPI strip (Total projects / Active) rendered 0 even though
the ListView beside it, backed by the same object, showed all rows. The stats
callback read `all.records` from `adapter.find('showcase_project', …)`, but
useAdapter() is the console's ObjectStackAdapter — its find() normalizes to a
QueryResult with a `data` array, not the REST envelope's `records`. The lookup
always missed, so `rows` was `[]` and both counts stuck at 0.
Read `.data` first (with `.records`/array fallbacks for robustness across
adapter shapes). Verified in a browser against a freshly-built showcase: the
cards now show Total 5 / Active 2, and selecting a row still updates Editing
without disturbing the counts.
The prior attempt at this (#2621) changed the query param `top`→`limit`, which
was not the cause — the result-shape mismatch was.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192Bo4EN62r2kgM35FsBiCp
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The CRM Workbench KPI strip (
Total projects/Active) rendered 0 even though the<ListView>beside it — backed by the sameshowcase_projectobject — showed all 5 rows. This fixes the count so the cards show the real totals.Before → After (same page, freshly-built showcase):
Why
The stats callback read
all.recordsfromadapter.find('showcase_project', …):But
useAdapter()in the console is the ObjectStackAdapter, whosefind()normalizes its result to aQueryResultwith adataarray — not the REST envelope'srecords. (normalizeQueryResultin@object-ui/data-objectstackreturns{ data, total, … }.) Soall.recordswas alwaysundefined,rowsfell back to[], and both counts stuck at 0. The emptycatchnever fired because the promise resolved fine — it was a shape mismatch, not a rejection.The fix reads
.datafirst, keeping.records/array fallbacks for robustness across adapter shapes:Verification
objectstack dev --ui --seed-admin), logged in as admin, drove the CRM Workbench in a real browser (Chromium): cards now read Total 5 / Active 2; selecting a row still updates Editing without disturbing the counts.pnpm --filter @objectstack/example-showcase test→ 53 passed.Scope
One-line behavioral fix in a single private example page (
examples/app-showcase), so no changeset (consistent with prior showcase-only commits).Out of scope — belong in objectui, not this repo
While re-verifying the #2616 findings against latest
main, I confirmed #2621 already resolved the RESTfieldscrash, the/ai/agents404 spam, the unbound page-header Mark Done, and the offline (picsum) seed images. The following remain and are objectui-side (vendored console / SDUI renderer), not fixable in framework metadata — filing separately:Project,Setting) instead of the app-nav's ownlabel(Projects,Settings) —UnifiedSidebar/useObjectLabeltreats the nav label as fallback and the i18n object label wins.START DATErendersOverdue Ndfor any past date —formatRelativeDateapplies the "Overdue" wording to every past date, ignoring thedueLikeflag it already computes for the red color.submitBehavior: { kind: 'thank-you' }is a valid spec prop but the in-consoleobject-formblock doesn't consume it (only public-forms'EmbeddableFormdoes), so the wizard still resets in place after Create.flexblock rendersitems-startand a region-root component'sresponsiveStyles(incl.alignItems) is stripped at build, so a column's children can't be made to stretch from metadata. TheintegerYAxisconfig (yAxis:[{stepSize:1}]) is also not honored byobject-chart(axis still shows 0.5/1.5).🤖 Generated with Claude Code
https://claude.ai/code/session_0192Bo4EN62r2kgM35FsBiCp
Generated by Claude Code