Skip to content

Commit 33568e3

Browse files
authored
Fix invalid JSON warning on empty binding arguments (#1749)
### WHAT is this pull request doing? Trim whitespace in `parseJSON` so empty or whitespace-only Arguments input returns `{}` instead of showing an error. Replace `window.alert` with `toast.error` for invalid JSON feedback. Fixes #1725 ### HOW can this pull request be tested? In the UI, try to add a binding to a queue with an empty space in the JSON input field - Should pass Then try to do the same but with invalid JSON - should not pass
1 parent 7a96ce1 commit 33568e3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

static/js/dom.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
function parseJSON (data) {
22
try {
3+
data = data.trim()
34
if (data.length) {
45
return JSON.parse(data)
56
}
67
return {}
78
} catch (e) {
8-
if (e instanceof SyntaxError) { window.alert('Input must be JSON') }
9+
if (e instanceof SyntaxError) { toast.error('Input must be JSON') }
910
throw e
1011
}
1112
}

0 commit comments

Comments
 (0)