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
- Install the module and library.
- Go to any "select" field (Could be a "List (Text)" field in a content type or other rendered forms.
- Inspect the page.
- 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. '' -> '{}'
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3316143-2-fixed_JSON_errors.patch | 361 bytes | Jacoboa |
| Select-JSON_Errors.png | 338.52 KB | Jacoboa |
Issue fork choices-3316143
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
Comment #2
Jacoboa commentedI had trouble with the issue fork, so I'll post the patch instead, sorry for that inconvenience.
The change is ready for review!
Comment #3
LeoAlcci commentedI will review it!
Comment #4
LeoAlcci commentedGreat job @Jacoboa, moving to RTBC.
Comment #5
LeoAlcci commentedComment #6
anybodyIMHO 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!Comment #7
grevil commentedI agree with @Anybody!
Comment #9
grevil commentedPlease review.
Comment #10
anybodyPerfect and the better solution, I think.
Comment #12
anybody@Jacoboa I'll still credit you, even if your approach wasn't taken. Thanks for the work on this.