WebSDKUIControl not updating UI

Xojo 2021 r3.1:
I’m having issues with WebSDKUIControls not updating on the browser (chrome, firefox, edge… doesn’t matter which one) unless I click away (change focus) and then back on the page from the browser side.
The control’s properties are being updated on the app side through a HandleURL event, then destroyed/recreated but the changes are not always being displayed browser side.

I’m trying to make this work over multiple sessions and it has proven very inconsistent.
First time sending the data to the app, the control in focus won’t update until the page’s focus is lost and regained or the other session’s control is updated and not the one in focus. This generally keeps happening until I refresh the browsers for all sessions and then works as expected (updates quick, for all sessions, no weird behavior)?

I have tried the following after recreating and updating the values of the control and have had no change:

WebSDKUIControl.UpdateBrowser()
WebSDKUIControl.UpdateControl(True)

WebView.SetFocus()

Wanting to see if anyone is having similar behavior? I feel like I have tried everything and the behaviour is still very inconsistent

I would think the problem could be in the render() event in the javascript side of the plugin.
I’ve never experimented such updating error in the xojo side.
be careful also to send very strict utf8 strings or json items from xojo to the browser, this can lead to tricky results…

I had been thinking the same with the javascript event. I realized that when controls load for the first time, the render() and updateControl() part of the javascript runs.

However, if I delete the control and recreate it or just change the image property of it via javascript, these methods are not called again.

Is this the correct behaviour?

The weirdest part is that if i refresh the tabs that the sessions are on, everything works as it should…

I will let people more experienced than me answer to this …
@Greg_O_Lone @Anthony_G_Cyphers

As a follow up to this post,
I had created a simple project with the VisualControls on a WebContainer (WebPage works too) to test this and it works perfectly with receiving HandleURL calls. All VisualControls update across all sessions.

Adding this exact code that works fine to a large project, and the VisualControls no longer update correctly. Usually, if no browsers are in focus then nothing updates until one is clicked on and it will change for one browser and not the other (.UpdateBrowser() doesn’t work).

I have been working on this issue for over a week and can’t work out why this doesn’t work as expected. At this stage, I’m just hoping that it’s somehow fixed in the next version of Xojo.

don’t forget to submit a feedback bug request
or for sure it won’t be fixed in the next release…

This sounds like some sort of timing issue. Could you post a link to your simplified project so that we might see if there’s something that jumps out at us?

2 Likes

That would be great thank you @Greg_O_Lone!

Just a follow-up if anyone found any issues with the code?

About this statement on your GitHub acct:

I have been testing this app with having mutliple tabs of Chrome open.

That’s going to cause you trouble right there. Because we use a session cookie and cookies for the same site are shared among all open tabs, they’ll all be seen as the same session by the app itself.

So to test multiple sessions I should be using incognito tabs / different browsers?

If it’s not, I wish this was written down somewhere on the session documentation so that myself and others wouldn’t make this same mistake

Different browsers would be best

1 Like

Another/final update:

In my cut-down example project using different browsers/sessions, this works fine.

However, I’ve worked out the issue… I’m led to believe that my large project is not updating over multiple sessions because the WebContainers are being embedded onto a webpage from a dictionary. This displays fine but is bugging out when receiving data as described in my post.

Change my project for WebContainers being ‘manually’ embedded and it all works fine.