-
Notifications
You must be signed in to change notification settings - Fork 2
feat(fields,components): optimize Lookup field popup with dynamic DataSource loading, keyboard nav, quick-create, and console integration #1042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4985204
48afc47
cb3dedc
ccee0ce
e701717
c9d0b55
9abe528
d33887c
8903bf5
fef49dc
8230707
6c3a801
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ import { Alert, AlertDescription } from '../../ui/alert'; | |
| import { AlertCircle, Loader2 } from 'lucide-react'; | ||
| import { cn } from '../../lib/utils'; | ||
| import React from 'react'; | ||
| import { SchemaRendererContext } from '@object-ui/react'; | ||
|
|
||
| // Form renderer component - Airtable-style feature-complete form | ||
| ComponentRegistry.register('form', | ||
|
|
@@ -57,6 +58,11 @@ ComponentRegistry.register('form', | |
| const [isSubmitting, setIsSubmitting] = React.useState(false); | ||
| const [submitError, setSubmitError] = React.useState<string | null>(null); | ||
|
|
||
| // Read DataSource from SchemaRendererContext and propagate it to field | ||
| // widgets as a prop so they can dynamically load related records. | ||
| const schemaCtx = React.useContext(SchemaRendererContext); | ||
| const contextDataSource = schemaCtx?.dataSource ?? null; | ||
|
|
||
| // React to defaultValues changes | ||
| React.useEffect(() => { | ||
| form.reset(defaultValues); | ||
|
|
@@ -313,6 +319,7 @@ ComponentRegistry.register('form', | |
| options: fieldProps.options, | ||
| placeholder: fieldProps.placeholder, | ||
| disabled: disabled || fieldDisabled || readonly || isSubmitting, | ||
| dataSource: contextDataSource, | ||
| })} | ||
|
Comment on lines
319
to
323
|
||
| </FormControl> | ||
| {description && ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section states that Lookup can obtain a
DataSourceviaSchemaRendererContext, but the current LookupField implementation relies on a dynamicrequire('@object-ui/react')fallback that won’t resolve under ESM-only@object-ui/reactexports. If the intended mechanism is “form renderer passesdataSourcedown”, consider updating the docs to describe that flow (or update the widget to use a real context import).