@@ -27,6 +27,7 @@ import { Alert, AlertDescription } from '../../ui/alert';
2727import { AlertCircle , Loader2 } from 'lucide-react' ;
2828import { cn } from '../../lib/utils' ;
2929import React from 'react' ;
30+ import { SchemaRendererContext } from '@object-ui/react' ;
3031
3132// Form renderer component - Airtable-style feature-complete form
3233ComponentRegistry . register ( 'form' ,
@@ -57,6 +58,11 @@ ComponentRegistry.register('form',
5758 const [ isSubmitting , setIsSubmitting ] = React . useState ( false ) ;
5859 const [ submitError , setSubmitError ] = React . useState < string | null > ( null ) ;
5960
61+ // Read DataSource from context so field widgets (e.g. LookupField) can
62+ // dynamically load related records without an explicit dataSource prop.
63+ const schemaCtx = React . useContext ( SchemaRendererContext ) ;
64+ const contextDataSource = schemaCtx ?. dataSource ?? null ;
65+
6066 // React to defaultValues changes
6167 React . useEffect ( ( ) => {
6268 form . reset ( defaultValues ) ;
@@ -313,6 +319,7 @@ ComponentRegistry.register('form',
313319 options : fieldProps . options ,
314320 placeholder : fieldProps . placeholder ,
315321 disabled : disabled || fieldDisabled || readonly || isSubmitting ,
322+ dataSource : contextDataSource ,
316323 } ) }
317324 </ FormControl >
318325 { description && (
0 commit comments