Problem/Motivation

in the latest dev version, the libraries are not successfully attached because of "Unexpected end of JSON input" errors caused by the default value of "Configuration options". I have attached a screenshot of the given errors and will shortly commit the changes.

Steps to reproduce

  1. Install the module and library.
  2. Go to any "select" field (Could be a "List (Text)" field in a content type or other rendered forms.
  3. Inspect the page.
  4. in the console tab will appear multiple unexpected JSON errors depending on the select options.

Proposed resolution

Add a new an empty JSON as the default install value instead of an empty string in the configuration_options in /config/install/choices.settings.yml. '' -> '{}'

Issue fork choices-3316143

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Jacoboa created an issue. See original summary.

Jacoboa’s picture

Assigned: Jacoboa » Unassigned
Status: Needs work » Needs review
StatusFileSize
new361 bytes

I had trouble with the issue fork, so I'll post the patch instead, sorry for that inconvenience.

The change is ready for review!

LeoAlcci’s picture

Assigned: Unassigned » LeoAlcci

I will review it!

LeoAlcci’s picture

Status: Needs review » Reviewed & tested by the community

Great job @Jacoboa, moving to RTBC.

LeoAlcci’s picture

Assigned: LeoAlcci » Unassigned
anybody’s picture

IMHO this doesn't seem to be very clear to me for end-users and I think the configuration option should be left empty, if no special configuration is needed, so I think the solution from #3316604: Validate "configuration_options" before using them to create a Choice. is the better one.

But I'll leave this open for the other maintainers to decide. Definitely the JS should neither break with {} nor '' as value in the textarea!

grevil’s picture

Status: Reviewed & tested by the community » Needs work

I agree with @Anybody!

grevil’s picture

Status: Needs work » Needs review

Please review.

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Perfect and the better solution, I think.

  • Anybody committed 36a4540 on 2.x authored by Grevil
    Issue #3316143 by Grevil, Jacoboa, Anybody: "Configuration options"...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

@Jacoboa I'll still credit you, even if your approach wasn't taken. Thanks for the work on this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.