- Issue created by @traviscarden
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
We know. See 🌱 [META] Redux sync on ALL prop types, not just ones with a single [value] property Active .
- First commit to issue fork.
- Merge request !301#3473702: Numeric field input crashes contextual settings panel → (Open) created by bnjmnm
- 🇺🇸United States bnjmnm Ann Arbor, MI
There was a utility function that would send everything through
Number()
that didn't result inNaN
- so things like spaces or strings that included only numerals would get changed to numbers.The fix is the same for this and 🐛 Space press in empty component props field inserts `0` Active so I just added a test that covers what the other issue reported.
- Status changed to Needs review
3 months ago 12:51am 12 September 2024 - Status changed to Needs work
3 months ago 2:31am 12 September 2024 - 🇺🇸United States traviscarden
Thanks, @bnjmnm. That fixes the bug in question in my local testing. Moving to "Needs work" though, since the tests are failing.
- Assigned to shyam_bhatt
- Issue was unassigned.
- 🇺🇸United States bnjmnm Ann Arbor, MI
Yikes, the random test failures in components-slots.cy.js are back with a vengance despite the changes in this issue having no impact on it whatsoever. I'll likely try a few things in this MR since it seems like the starts aligned to make the random fails happen pretty reliably here
- Status changed to Needs review
3 months ago 2:29pm 12 September 2024 - 🇺🇸United States bnjmnm Ann Arbor, MI
Lets keep the
components-slots.cy.js
fixes in there if we can even if it is technically out of scope - it'll make life easier for everyone. - 🇺🇸United States Kristen Pol Santa Cruz, CA, USA
I assume this is related:
🐛 String props that are integer values aren't treated as strings Postponed
- 🇺🇸United States traviscarden
I assume this is related: 🐛 String props that are integer values aren't treated as strings Postponed
Yes. That issue has been marked as a duplicate of this one.
I've manually tested again and confirmed that, of course, it still works. A quick review of the JS code (not my area of expertise) should wrap this up.
- Assigned to hooroomoo
- Status changed to RTBC
3 months ago 5:13pm 16 September 2024 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Needs @hooroomoo's (or @effulgentsia's) approval on the MR before this can be merged, but LGTM!
(Just one nit/suggestion, not commit-blocking.)
- Status changed to Needs work
3 months ago 5:28pm 16 September 2024 - 🇺🇸United States hooroomoo
Found a regression where it breaks the
element. Could be worth adding a test for that too. - Issue was unassigned.
- 🇺🇸United States bnjmnm Ann Arbor, MI
It looks like this specifically breaks select elements with
type: integer
and wasn't caught e2e because the only select elements with tests right now are string based. This issue makes sense as the cast-to-number is currently specific to numeric inputs. This logic will need to be expanded to check data type, and we should add an integer select to the sdc_test_all_props component. - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
we should add an integer select to the sdc_test_all_props component.
At least this part is Novice and is a great contribution for DrupalCon Barcelona!
Dear Barcelona code sprint participant: see
/tests/modules/sdc_test_all_props/components/all-props/all-props.component.yml
. Seetest_string_enum: title: 'String - Enum' type: string enum: - foo - bar examples: - foo
What @bnjmnm identified is that we should have a similar SDC prop for integers:
type: integer
andenum: …
. - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Related: over at 📌 [later phase] Support matching `{type: array, …}` prop shapes Postponed , I've had to add:
diff --git a/themes/engines/semi_coupled/semi_coupled.engine b/themes/engines/semi_coupled/semi_coupled.engine index 7890e549..cfe2abb6 100644 --- a/themes/engines/semi_coupled/semi_coupled.engine +++ b/themes/engines/semi_coupled/semi_coupled.engine @@ -276,7 +276,7 @@ function _semi_coupled_collect_props(array &$props, array &$slots, array $prop_t * @return array|string|object|null * Essentially $variables[~$index_in] or $variables->{~$index_in}. */ -function _semi_coupled_get_variable(array|object $variables, string $index_in_js_format): array|string|object|bool|null { +function _semi_coupled_get_variable(array|object $variables, string $index_in_js_format): array|string|object|bool|null|int { // The lookup information we have is camelCased, but the values are likely // in snake case, so we create a snake case formatted index. $index_in_php_format = _semi_coupled_snake_case($index_in_js_format);
- First commit to issue fork.
- 🇬🇧United Kingdom jessebaker
In an attempt to push this issue along, I went ahead and added the test described by @bnjmnm in #17. Unfortunately this appears to have highlighted a further problem. Or perhaps this is actually the symptom of the problem @bnjmnm is referring to in that comment.
When props that are NOT the new Integer Enum (select) field are updated, the value of the Integer select field is NOT sent to the back end.
IOW the initial value of the select does not appear to be correctly updated in the redux store when loading the form for the first time.
- 🇺🇸United States bnjmnm Ann Arbor, MI
This is addressed much more easily with the schemas fully available which is happening in 🐛 Premature prop validation can break the UI Active , so I addressed the reported issue there + included tests to verify it is fixed. Get that one reviewed/codeowner signed and the symptoms reported here are fixed in a less hacky way than what can currently be done off 0.x