Commit 517f252
fix(visual-editor): load DB FieldType IDs once in container, pass to modal synchronously
The modal's field type dropdown needs DB-correct IDs for new field
creation, but the previous async approach (loading inside the modal)
caused race conditions and empty dropdowns.
Fix: load FieldTypes from the DB once in the visual editor container
component on init, pass them to the field modal via MAT_DIALOG_DATA.
The modal receives dbFieldTypes synchronously in its constructor and
passes them to getTranslatedTypes(), which remaps the hardcoded enum
ordinals to actual DB IDs by matching on the type name string.
If dbFieldTypes is empty (API not loaded yet), falls back to the
hardcoded enum ordinals — preserving the original behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f456488 commit 517f252
File tree
2 files changed
+28
-32
lines changed- eform-client/src/app/modules/eforms/eform-visual-editor/components
- eform-visual-editor-elements/field/visual-editor-field-modal
- eform-visual-editor-page/eform-visual-editor-container
2 files changed
+28
-32
lines changedLines changed: 15 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
79 | 63 | | |
80 | 64 | | |
81 | 65 | | |
82 | 66 | | |
83 | 67 | | |
84 | 68 | | |
85 | | - | |
86 | 69 | | |
87 | 70 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
92 | 74 | | |
93 | 75 | | |
94 | 76 | | |
| |||
123 | 105 | | |
124 | 106 | | |
125 | 107 | | |
| 108 | + | |
126 | 109 | | |
127 | 110 | | |
128 | 111 | | |
129 | 112 | | |
130 | 113 | | |
| 114 | + | |
131 | 115 | | |
132 | 116 | | |
133 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
132 | 144 | | |
133 | 145 | | |
134 | 146 | | |
| |||
320 | 332 | | |
321 | 333 | | |
322 | 334 | | |
323 | | - | |
| 335 | + | |
324 | 336 | | |
325 | 337 | | |
326 | 338 | | |
| |||
0 commit comments