Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the last item in a multiselect creates a map error in the console. #1205

Open
dtracey-fi opened this issue Nov 26, 2023 · 2 comments

Comments

@dtracey-fi
Copy link

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

  1. Add One and Two to the multiselect field.
  2. Remove One and Two from the multiselect field.
@henrik-dons
Copy link

Any updates on this?

@Youdaman
Copy link

Looks to be a duplicate of #1182

Also waiting for an update on this please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants