Commit 4e0edeb
refactor(value-editor): own validity instead of the format row
The parse check lived inside LanguageValidation, which renders inside
LanguageSelector, so validity only existed when the format row did. That
is why the SAML field could ask for language='xml' and get no XML
validation: hiding the row hid the check with it.
ValueEditor computes it now and passes it down, so LanguageValidation is
presentational and can be rendered anywhere. Callers can read it too, via
onValidityChange.
saveFeatureWithValidation still reads 'language-validation-error' off the
DOM, so that id stays. Moving it onto the callback needs a decision this
change should not make on its own: the DOM query is global, so today a
parse error in a segment override also blocks saving the feature value,
and a callback has to say which editors gate which save.
Also documents why onChange hands back a string rather than a
FlagsmithValue: this edits text, and deciding "123" is a number is domain
logic that belongs to the caller. Two SegmentOverrides handlers were still
annotated as taking events and wrapping in safeParseEventValue, which has
been a no-op since ValueEditor started passing strings.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent c31e024 commit 4e0edeb
4 files changed
Lines changed: 48 additions & 28 deletions
File tree
- frontend/web/components
- ValueEditor
- components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 220 | + | |
225 | 221 | | |
226 | 222 | | |
227 | 223 | | |
| |||
286 | 282 | | |
287 | 283 | | |
288 | 284 | | |
289 | | - | |
| 285 | + | |
290 | 286 | | |
291 | | - | |
292 | | - | |
293 | | - | |
| 287 | + | |
294 | 288 | | |
295 | 289 | | |
296 | 290 | | |
| |||
307 | 301 | | |
308 | 302 | | |
309 | 303 | | |
310 | | - | |
| 304 | + | |
311 | 305 | | |
312 | | - | |
313 | | - | |
314 | | - | |
| 306 | + | |
315 | 307 | | |
316 | 308 | | |
317 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
2 | 10 | | |
3 | 11 | | |
4 | 12 | | |
| |||
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
| 19 | + | |
11 | 20 | | |
12 | 21 | | |
13 | 22 | | |
| |||
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
38 | 52 | | |
39 | 53 | | |
40 | 54 | | |
| 55 | + | |
41 | 56 | | |
42 | 57 | | |
43 | 58 | | |
| |||
62 | 77 | | |
63 | 78 | | |
64 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
65 | 90 | | |
66 | 91 | | |
67 | 92 | | |
| |||
90 | 115 | | |
91 | 116 | | |
92 | 117 | | |
| 118 | + | |
93 | 119 | | |
94 | 120 | | |
95 | | - | |
96 | 121 | | |
97 | 122 | | |
98 | 123 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | | - | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
Lines changed: 11 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
| 33 | + | |
31 | 34 | | |
32 | | - | |
33 | 35 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
0 commit comments