-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
I have some code that does that I use to fill data-pat-autosuggest:
options = {"prefill-json": [{"id: "john-snow", "text": "John Snow"]}
return json.dumps(options)I had to change it like this:
options = {"prefill-json": json.dumps([{"id: "john-snow", "text": "John Snow"])}
return json.dumps(options)otherwise I got the error:
SyntaxError: non-JSON data given to pat-autosuggest
The reason for the need for this change is that this line:
Patterns/src/pat/auto-suggest/auto-suggest.js
Line 230 in 3b0cdbc
| const data = JSON.parse(this.options.prefillJson); |
Tries to parse in to a Json something which is already an array.
I think that it would be convenient to check if prefillJson is a string before trying to apply JSON.parse.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels