Is there a actual valid workaround for Javascript errors?

Followed a few threads on here regarding removing of javascript errors. I have now removed all on the fly created containers.

I have a control array of containers on a webpage that are loaded in the IDE.
I also have a canvas which I load an image onto in the paint event.
I have added a timer which displays the page which is initally off

I fire the timer from another page as mode 1 then timer.reset, the timer waits 3 seconds then updates the containers positions and displays the page in question., then shows the page.

I still get javascript errors and containers which have not been set correctly on the screen. Is there a specific xojo preferred method to draw containers and canvases without getting errors.

Do you have any code at all in Open events of WebPages or controls? If so, is any of it attempting to change the visual state of any controls?

Do you have any controls that start invisible? This might be a fairly recent issue that some of us are looking into.

Sometimes I have to clear the cache to get javascript errors to go away.

Any chance things worked in 2013r3 and earlier, and broke in 2013r3.2?

Actually, it’s not odd at all. Here’s the fix that seems to be causing a lot of trouble for several people:

<https://xojo.com/issue/29827>

One thing I’ve seen in two people’s code is that the Shown events are a little more aggressive than my tastes about doing things in other pages or other containers. For example, Container.Shown calls a method that sets visible of controls of some other container. I know it’s probably not easy if you are doing that, but don’t do that.

Been thinking about this a lot the past few days. While I think I have my mind around what Greg did to fix that problem, I also think it may require some explanation and guidance about what’s safe to do in a “Shown” event and what might need to be moved to later, e.g. as a WebTimer event fired after the page is shown.

Brad,

Do me a favor and try things out in the latest beta. We did some work to clear up the Open vs Shown issues to make it a little more predictable across controls.

Dean’s issues persist on latest beta (b3). I think the general problem is that some of his container Shown events attempt to set visible of controls in other containers (e.g. WebPage1.Container.myListBox.visible = true), triggering Refresh’s of controls that aren’t instantiated on the client side. I’ve suggested he refactor things a bit, but I know it would be a lot of work for him. What he’s doing isn’t pretty, but the fix for #29827 seems to be aggressive on refreshing things that aren’t there yet.

I can only think of one “fix” that would have caused all of this. There was a bug where if you resized a WebContainer that was hidden, when you made it visible, the contents would be rendered at the old size (or not at all). Now when you change the size, the contents are told to redraw themselves.

If there’s a case for it, I’ll look at it when we get back on Monday.

I’ll file a case describing it. We have symptoms. I don’t have an example project which belongs to me. The examples I’ve seen are complicated, to say the least.

Filed: <https://xojo.com/issue/31056>

Dave, if you’d like to help this get fixed, please privately attach your project to that bug. That way Greg can see if he’s fixed the issue. I do not have a good sample for this because it seems to depend on a coding style I don’t use.