Unable to send focus message from script to running session

Does anyone know what could be causing a flood of these messages in our console?

You’ve got a property change script somewhere trying to call self.focus() - start with that in the Find/Replace tool?

It looks like the error itself might be due to a race, where you’re trying to call focus after the component involved has already been removed on the front-end, likely due to navigation.

I have a customer property setup on a text field and every 300 ms it calls self.focus(). This is to force the focus back into the TextField if the user touches something else on the screen. Is there something I can put in the code so it will not call self.focus() when the component is no longer on the screen?

I still have not figure out how to stop this from happening. I can reproduce the error.

I have a customer property on a text box bound to now(100) then I have a change script with the following on the customer property:

image

	if self.custom.runTimer:
		if self.custom.counter >= self.custom.trigger:
			self.focus()
			self.custom.counter = 0
		else:
			self.custom.counter += 1

when this code is running and I close teh browser window I will see the console get logged with the error. Any suggestion of how I can stop this custom change script from running when the browser window gets closed?

Is this supposed to fix my issue? I am running 8.0.16 and these release note is from 8.1.1 RC1

No - because it’s a Vision specific bug. Have you contacted support with your issue above?

@cmallonee may know a workaround to prevent a script from running in the time between ‘browser tab closed’ and ‘backend session terminated’.

You could execute some script in the View Shutdown Event to set a property, and then check against this property to verify the View is still running.


Then modify your code to use the new property:

if self.custom.runTimer and self.view.custom.running:
	if self.custom.counter >= self.custom.trigger:
		self.focus()
		self.custom.counter = 0
	else:
		self.custom.counter += 1
1 Like

Setting running to False in the view shutdown script does not seem to have an effect. I still get flooded with this when I close the browser window.

Does it maybe matter that this view is embedded?

If you modified your script as suggested then I wouldn’t expect it to reach the focus() call. Could you provide a screenshot of the code you’re using? have you tried putting in logging in that area to verify the property is being set as part of the Shutdown Event?