Edit page: bounded + live-searchable relationship dropdowns#638
Conversation
…t page
Replace the unbounded findMany({}) in item-form preparation with
getRelationshipOptions (bounded, take-limited, selected-id seeded).
ComboboxField and RelationshipManager gain debounced live search via the
relationshipOptions serverAction op, falling back to client-side filtering
when no server action is wired.
Closes #631
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVrp6NFf7v2WrxCT7d8i3Z
🦋 Changeset detectedLatest commit: 888d169 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…pSearch A failed serverAction call left isSearching stuck true forever and produced an unhandled promise rejection. Catch the error, log it, fall back to an empty result set, and always clear isSearching. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVrp6NFf7v2WrxCT7d8i3Z
Self-reviewOverview: Replaces the per-relationship-field unbounded Code quality / conventions
Issue found during self-review (fixed, pushed in
Test coverage
Risks / follow-ups (non-blocking)
Lint, format ( Generated by Claude Code |
Coverage Report for Core Package Coverage (./packages/core)
File CoverageNo changed files found. |
Coverage Report for UI Package Coverage (./packages/ui)
File CoverageNo changed files found. |
Coverage Report for CLI Package Coverage (./packages/cli)
File CoverageNo changed files found. |
Coverage Report for Auth Package Coverage (./packages/auth)
File CoverageNo changed files found. |
Coverage Report for Storage Package Coverage (./packages/storage)
File CoverageNo changed files found. |
Coverage Report for RAG Package Coverage (./packages/rag)
File CoverageNo changed files found. |
Coverage Report for Storage S3 Package Coverage (./packages/storage-s3)
File CoverageNo changed files found. |
Coverage Report for Storage Vercel Package Coverage (./packages/storage-vercel)
File CoverageNo changed files found. |
Summary
findMany({})inprepareItemFormwithgetRelationshipOptions(context, config, relatedListName, { selectedIds })— the edit page's relationship dropdowns now fetch a bounded, take-limited window per relationship field instead of scanning the whole related table, and always union the item's currently-selected id(s) so their label renders even outside that window.ComboboxField(single) andRelationshipManager(many) gain debounced live search via a new shared hook (useRelationshipSearch) that calls therelationshipOptionscontext.serverActionop, seeded with the server-rendered initial window. Typing narrows results server-side against the label field.listKey/serverActionthroughItemFormClient→FieldRenderer→RelationshipField→ComboboxField/RelationshipManager(all optional — components without them fall back to client-side filtering over the initial window, unchanged from previous behavior).{ id, label }[]plus the list/field metadata needed to issue a search crosses the client boundary.Test plan
prepareItemFormasserting every relationship fetch is take-bounded and unions the current selection (single and many), including the create-mode no-selection case (packages/ui/tests/lib/prepareItemForm.test.ts)ComboboxFieldcovering initial-value label rendering, debounced server search call shape, and persisting a selection found via search (packages/ui/tests/components/ComboboxField.test.tsx)RelationshipManagercovering connected-item labels, excluding already-connected items from search candidates, the debounced search call shape, and that a mid-session connection found via search keeps its label (packages/ui/tests/components/RelationshipManager.test.tsx)packages/uiandpackages/coretest suites pass (209 and 766 tests respectively)pnpm lint,pnpm manypkg fix,pnpm formatall pass clean@opensaas/stack-ui: minor)Closes #631
Generated by Claude Code