web-components
web-components copied to clipboard
fix: prevent possible errors in custom-field checkValidity
Description
Fixes https://github.com/vaadin/flow-components/issues/6739
Updated checkValidity() method to check that this.inputs and this.value are defined before accessing them.
Type of change
- Bugfix
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Hi @web-padawan and @web-padawan, when i performed cherry-pick to this commit to 24.4, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 82bfd11f8330642d77a33c41d1554a8dd973dc6c
error: could not apply 82bfd11f83... fix: prevent possible errors when inputs property is not set (#8012)
hint: After resolving the conflicts, mark them with
hint: "git add/rm
@web-padawan Just seen that you added target 24.4 but I never had this problems in 24.4. So maybe backport is not needed as there is all ok?
We do have problems with the original change using the latest v24.4.17 platform (v24.4.12 Vaadin Flow) version. In some cases the inputs property is still undefined in the ready phase:
generated-flow-imports-CjbTJID0.js:7519 Uncaught TypeError: Cannot read properties of undefined (reading 'filter')
at CustomField.checkValidity (generated-flow-impor…CjbTJID0.js:7519:39)
at CustomField.validate (indexhtml-GaOLT410.js:20753:28)
at CustomField._requiredChanged (generated-flow-impor…CjbTJID0.js:7535:12)
at Object.runMethodEffect [as fn] (indexhtml-GaOLT410.js:9666:39)
at runEffects (indexhtml-GaOLT410.js:9210:16)
at CustomField._propertiesChanged (indexhtml-GaOLT410.js:10301:7)
at Dx.s2._propertiesChanged (FlowClient-CfFCB582.js:9090:12)
at CustomField._flushProperties (indexhtml-GaOLT410.js:8203:16)
at CustomField.ready (indexhtml-GaOLT410.js:10269:12)
at CustomField.ready (indexhtml-GaOLT410.js:12080:13)
at CustomField.ready (indexhtml-GaOLT410.js:15164:13)
at CustomField.ready (indexhtml-GaOLT410.js:15443:13)
at CustomField.ready (indexhtml-GaOLT410.js:20709:13)
at CustomField.ready (indexhtml-GaOLT410.js:20882:11)
at CustomField.ready (generated-flow-impor…CjbTJID0.js:7465:11)
at Dx.s2.ready (FlowClient-CfFCB582.js:9095:12)
@web-padawan could you backport this fix to the 24.4 branch as well? 🙏🙇♂️
Sorry about not answering earlier, here's a PR with the cherry-pick to 24.4: https://github.com/vaadin/web-components/pull/8368