carbon-fields
carbon-fields copied to clipboard
Removing the last item in a multiselect creates a map error in the console.
Version
- Carbon Fields: 3.6.2
- WordPress: 5.4.1
- PHP: 8.0
Expected Behavior
The user should be able to add all options to the multiselect field, and then remove them all.
Actual Behavior
Upon removing the last item in the multiselect, an error appears in the console, and the last item isn't removed.
Uncaught TypeError: Cannot read properties of null (reading 'map') at Object.onChange (core.min.js?ver=3.6.2:1:349535) at n.value (core.min.js?ver=3.6.2:1:348174) at e.onChange (core.min.js?ver=3.6.2:1:347471) at r.onChange (core.min.js?ver=3.6.2:1:322858) at r.removeValue (core.min.js?ver=3.6.2:1:324239) at onClick (core.min.js?ver=3.6.2:1:341192) at Object.Xa (react-dom.min.js?ver=18.2.0:10:105741) at B (react-dom.min.js?ver=18.2.0:10:10501
Container definition
Field::make('multiselect', 'test', 'Options')->add_options([
'one' => 'One',
'two' => "Two",
]),
Steps to Reproduce the Problem
- Add One and Two to the multiselect field.
- Remove One and Two from the multiselect field.
Any updates on this?
Looks to be a duplicate of https://github.com/htmlburger/carbon-fields/issues/1182
Also waiting for an update on this please.
Join this and waiting for updates...
Fixed here: https://github.com/htmlburger/carbon-fields/commit/0103f0da9cac6ab9adfc067eb9fbacc4690f5b0b It will be included in next release
Wow, that is a much needed fix for me. Looking anxiously for this release.
The fix for this issue is now released in https://github.com/htmlburger/carbon-fields/releases/tag/v3.6.5