[Bug-16195]Quality Overlay In Final Column Of Column Container Breaks Container

I have a script that runs on a dropdown value change script that affects another drop downs options. The value change script is like this

import components.dropdowns
components.dropdowns.setOptions(self.getSibling("DD_Locations"), "listlocations", "name")

and setOptions is

def setOptions(dropDown, dbTable,labelColumn, where=None, placeHolder=True, valueColumn="idx"):
	"""
	Handles setting options on dropdowns using convetions of a -2 value with label "Select ..."
	Args:
		dropDown: reference to the dropdown
		dbTable: str, name of the database table to query from
		labelColumn: str, name of column in database table to grab labels from
		filter: str, if you need a WHERE clause, enter it into this parameter like "WHERE parentCustomerId = 54" with no spaces on either side
		placeHolder: boolean, default is True, if True, create top row for the dropdown with value -2 and label "Select..."
		valueColumn: str, name of the column you want to be the value in the dropdown, default is idx
	Returns:
		Nothing, sets the value of the dropdown
	"""
	import system.db
	placeHolderQuery = "SELECT -2 as 'Value', 'Select...' as 'Label' UNION"
	optionsQuery = 	"""
					SELECT %s as 'Value', %s as 'Label'
					FROM %s
					%s
					ORDER by Label
					"""%(valueColumn, labelColumn, dbTable, where)
	if placeHolder:
		finalQuery = placeHolderQuery + optionsQuery
	else:
		finalQuery = optionsQuery
	data = system.db.runQuery(finalQuery)
	system.perspective.print(finalQuery)
	system.perspective.print(str(data))
	dropDown.props.options = data

But then changing my customers dropdown, I start getting this error in designer on repeat which disallows me from changing anything else or saving the project, I have to exit.

09:06:04.089 [Browser Events Thread] INFO Perspective.Designer.BrowserConsole - [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[m#undefined.render()]'

The reason we’re doing this by the way was because, and I couldn’t figure out way, occasionally the bindings of certain components would seem to not fire, so I was told by a superior to just make it all happen programatically so we could have more control. I have limited experience with React but I know it needs to know about all changes on the front end and maybe I’m circumventing that in a bad way here? Any ideas?

This is another error that appears as well

09:42:17.812 [Browser Events Thread] INFO Perspective.Designer.BrowserConsole - [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[C#undefined.render()]

I know generally with React you have to declare stuff that is going to be changeable so React knows to track it, but I don’t know by which what mechanism Ignition is able to script that to react or what, my intuition is that the lack of binding on the options meant Ignition didn’t tell React to track the options, and then I am changing it which is messing with it, but that’s just my guess.

could you supply the view.json file for the View which contains the dropdowns you’re working with?

I exported the view and the components library I made that it uses.

newAssetNew.zip (30.2 KB)

We haven’t locked down the exact cause, but it seems to be a result of the Image and Lbl_Saved components having Bad_Stale quality bindings while in a Column Container. I placed a custom confirmation property on each of the Dropdowns which are expected to have such a property and I was then unable to trigger the issue.

The issue also did not occur when I used the original components in a Coordinate Container.

You could also just re-arrange the components which could potentially have Quality Overlays if bindings fail to not render in the final column.

I updated the thread title to more accurately reflect the error, because the scripting in use technically had nothing to do with the error at hand.

1 Like