fix(webapp): unwrap the {items} envelope for kb.list_* results#555
fix(webapp): unwrap the {items} envelope for kb.list_* results#555plind-junior wants to merge 1 commit into
Conversation
kb.list_* moved from a bare array to a `{items, _meta}` dict envelope
(server deprecation, remove_in 1.4.0), but the webapp still typed and
consumed these as flat arrays — so `r.data.map` in Shell and PendingView
threw "map is not a function", crashing the whole tree through the error
boundary on every page, the pending queue included.
unwrap `items` once in rpc(), scoped to kb.list_* methods, tolerating the
old bare-array shape and leaving kb.list_sessions ({sessions}) and non-list
object results untouched. one central change fixes the pending page and
every list view; the fan-out, optimistic caches, and views are unaffected.
|
this PR changes UI (web/, src/vouch/web/, or webapp/) but has no before/after screenshots in the description. UI changes are reviewed by screenshot, not by running the app. add before and after screenshots, then reopen. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesRPC list response compatibility
Estimated code review effort: 2 (Simple) | ~10 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
this PR changes UI (web/, src/vouch/web/, or webapp/) but has no before/after screenshots in the description. UI changes are reviewed by screenshot, not by running the app. add before and after screenshots, then reopen. |
the pending page (and every list view) was crashing the whole tree through the error boundary with
TypeError: r.data.map is not a function.root cause:
kb.list_*results moved from a bare array to a{items, _meta}dict envelope (server deprecation, remove_in 1.4.0), but the webapp still typed and consumed them as flat arrays.Shell.tsxandPendingView.tsxcallr.data.map(...)on the fan-out rows, so a{items, _meta}payload has no.mapand throws — and sinceShellrenders on every route, the error boundary swallows the entire app, not just the pending queue. thekb.list_sessionssibling right above was already defensive (r.data?.sessions ?? []), which is why it never surfaced there.fix: unwrap
itemsonce inrpc(), scoped tokb.list_*methods, tolerating the old bare-array shape and leavingkb.list_sessions({sessions}) and non-list object results untouched. one central change repairs the pending page and any list view; the fan-out, optimistic caches, and views are unaffected.verified live against a running
vouch serve(kb.list_pendingreturns{items, _meta}): the pending page renders, the sidebar counts populate, zero console errors. tests add fourrpc()cases (unwrap list envelope, pass bare array through, leave{sessions}alone, don't unwrap non-list methods). full webapp suite green (153), tsc clean.Summary by CodeRabbit
Bug Fixes
Tests