question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Editor value is not refreshed with nested DescribedBy property

See original GitHub issue

General information

  • json-editor version: 1.4.0-beta.0

Expected behavior

Everytime propertyType is selected, editor.getValue() function / UI JSON edit should reflect actual value of propertyTypeOptions depending on selection

Actual behavior

Editor value is not refreshed or holds previous value before selection. Without nesting as in original describedBy example seem to work ok

Steps to reproduce the behavior

Direct link LINK

{
	"type": "object",
	"title": "Property for Sale",
	"properties": {
		"propertyName": {
			"type": "string",
			"title": "Property Name",
			"description": "The name of the property being sold"
		},
		"propertyType": {
			"type": "string",
			"title": "Property Type",
			"enum": [
				"",
				"house",
				"car",
				"yacht"
			]
		},
		"Config": {
			"type": "object",
			"properties": {
				"propertyTypeOptions": {
					"type": "object",
					"title": " ",
					"watch": {
						"propertyType": "propertyType"
					},
					"options": {
						"disable_properties": true,
						"disable_edit_json": true,
						"disable_collapse": true
					},
					"links": [{
						"rel": "describedBy",
						"href": "#/definitions/{{propertyType}}"
					}]
				}
			},
			"required": ["propertyTypeOptions"]
		}
	},
	"required": [
		"propertyName",
		"propertyType",
		"Config"
	],
	"definitions": {
		"house": {
			"properties": {
				"address": {
					"type": "string",
					"title": "Address"
				},
				"rooms": {
					"type": "integer",
					"title": "Number Of Rooms"
				}
			}
		},
		"car": {
			"properties": {
				"brand": {
					"type": "string",
					"title": "Brand",
					"enum": [
						"Audi",
						"BMW",
						"Chevrolet",
						"Opel",
						"Mitsubishi"
					]
				},
				"color": {
					"type": "string",
					"title": "Color",
					"format": "color"
				},
				"year": {
					"type": "string",
					"title": "Build Year"
				}
			}
		},
		"yacht": {
			"properties": {
				"name": {
					"type": "string",
					"title": "Name"
				},
				"model": {
					"type": "string",
					"title": "Model"
				},
				"year": {
					"type": "integer",
					"title": "Year"
				},
				"yachtLength": {
					"type": "integer",
					"title": "Length"
				}
			}
		}
	}
}

Workaround

Watch field programmatically and trigger setValue/onChange

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
pmk65commented, Jul 22, 2019

Fix added in #401 PR.

0reactions
pmk65commented, Aug 5, 2019

I have posted a separate bugreport #443 with a test example. (I tried fixing it, but I just can’t pinpoint where it goes wrong.) Look at the JavaScript tab on the Playground example. It just wait for the ready event, then it deletes the JSON-Editor instance and re-create it again.

I’m going to remove DescribedBy too from my layout test case too, as I can’t make an example with the various configurable options if the editor can’t be recreated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble with refreshView in Nested Components
I've attempted putting the handlers in both the child component and the parent Pane component with no difference in behavior. Lastly I tried ......
Read more >
Nested ListView is not refreshed - DevExpress Support
Yes, when the List View MasterDetailMode property is set to ListViewAndDetailView and a user makes changes in its Detail View, the List View...
Read more >
How to access nested object value using string so I can edit? - Stack ...
If you need it without dependencies, this function will update the value described by thearray : function setObjectValue(o, a, v) { a =...
Read more >
New property in Element / Nested Content Not Being Saved ...
Under Content enter a value for the new TextString property for an existing "Feature" under a "Product"; Click Save and Publsih; Refresh the ......
Read more >
Object.defineProperty() - JavaScript - MDN Web Docs
A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found