mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 22:29:11 +03:00
fix: update template fields atomically to prevent state race conditions
- Combine name, comment, and columns updates into single onUpdateField call - Fixes issue where fields weren't populating due to React closure stale state - Remove debug console.log statements
This commit is contained in:
1 parent
6cd09cf938
commit
a32a49203d
1 file changed
+6
-3
+6
-3
@@ -286,9 +286,12 @@ export const TableEditor = ({
|
||||
<TableTemplateSelector
|
||||
variant={tableQuickstartVariant}
|
||||
onSelectTemplate={(template) => {
|
||||
if (template.name) onUpdateField({ name: template.name })
|
||||
if (template.comment) onUpdateField({ comment: template.comment })
|
||||
if (template.columns) onUpdateField({ columns: template.columns })
|
||||
// Update all fields at once to avoid closure issues
|
||||
const updates: Partial<TableField> = {}
|
||||
if (template.name) updates.name = template.name
|
||||
if (template.comment) updates.comment = template.comment
|
||||
if (template.columns) updates.columns = template.columns
|
||||
onUpdateField(updates)
|
||||
}}
|
||||
disabled={false}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user