Unexpected behavior with watch and dependencies
See original GitHub issueGeneral information
- json-editor version: https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/css/jsoneditor.min.css https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.js https://cdn.jsdelivr.net/npm/bootstrap@3.4.0/dist/css/bootstrap.min.css https://cdn.jsdelivr.net/npm/bootstrap@3.4.0/dist/js/bootstrap.min.js https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
Expected behavior
Field “description1a” should show when field “useDescription1” is false. Field “description1b” should show when field “useDescription1” is true. Field “description2a” should show when field “useDescription2” is false. Field “description2b” should show when field “useDescription2” is true.
Actual behavior
Field “description1a” shows when field “useDescription1” is false. Field “description1b” never shows up when field “useDescription1” is true. Field “description2a” shows when field “useDescription2” is false. Field “description2b” never shows up when field “useDescription2” is false.
Steps to reproduce the behavior
Direct link to example:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/pkej/schemas/master/link.schema.json",
"$ref": "#/definitions/link",
"definitions": {
"link": {
"type": "object",
"id": "link",
"properties": {
"useDescription1": {
"type": "boolean",
"default": true,
"title": "Desciption1?",
"format": "checkbox"
},
"description1a": {
"type": "string",
"title": "Description1a",
"htmlClass": "formName",
"default": "Description1a",
"watch": {
"enable": "link.useDescription1",
"uri": "link.uri"
},
"options": {
"dependencies": {
"useDescription1": false
}
}
},
"description1b": {
"type": "string",
"title": "Description1b",
"htmlClass": "formName",
"default": "Description1b",
"watch": {
"enable": "link.useDescription1",
"uri": "link.uri"
},
"options": {
"dependencies": {
"useDescription1": true
}
}
},
"useDescription2": {
"type": "boolean",
"default": false,
"title": "Desciption2?",
"format": "checkbox"
},
"description2a": {
"type": "string",
"title": "Description2a",
"htmlClass": "formName",
"default": "Description2a",
"watch": {
"enable": "link.useDescription2",
"uri": "link.uri"
},
"options": {
"dependencies": {
"useDescription2": false
}
}
},
"description2b": {
"type": "string",
"title": "Description2b",
"htmlClass": "formName",
"default": "Description2b",
"watch": {
"enable": "link.useDescription2",
"uri": "link.uri"
},
"options": {
"dependencies": {
"useDescription2": true
}
}
},
"url": {
"type": "string",
"title": "URI (url)",
"htmlClass": "formURL",
"fieldHtmlClass": "input-xxlarge",
"placeholder": "https://",
"default": "https://",
"format": "url",
"examples": [
"https://www.curseforge.com/minecraft/mc-mods.jeid"
]
}
}
}
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
expected workspace package to exist · Issue #7807 · ...
What is the current behavior? yarn install fails with: error An unexpected error occurred: "expected workspace package to exist for \"@babel/ ...
Read more >Detecting unexpected behavior could be key to securing AV ...
What to watch: Behavior-based security systems must have the capability to learn vehicle behavior independently, without dependency on every ...
Read more >Unexpected behavior of R when trying to install dplyr
Go to your R library path (where your packages are stored): C:\Users\username\Documents\R\win-library\3.5. You can refer to this guide on ...
Read more >JAR Hell
A list of the problems that make up JAR hell (classpath hell, dependency hell) and how they relate to development tools like Maven...
Read more >Error Codes | Yarn - Package Manager
In some situation Yarn might detect that node-gyp is required by a package without this package explicitly listing the dependency. This behavior is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The dependencies functions uses the internal watch functions. So my guess is that it chokes when you use the same property with
dependencies
andwatch
. (But unfortunately not something easily fixed, due to the shared code.)But maybe you can rearrange your schema so the property is inside an object, and then use the object property for the dependencies?
And thanks for the quick response 😃