Rendering only once on property changes

I have many computed properties on the WebSDK controls.
Sometimes changing a computed property can require a ton of changes to the control such that its HTML needs to be re-rendered completely.
The getter often looks something like:

Set mFocusStyle = value if ControlAvailableInBrowser then Render? end End Set

The problem is when the user changes several of the more complicated properties in a row:

mySpriteButton.Sprite = sprite1 mySpriteButton.SpriteHover = sprite2 mySpriteButton.SpritePressed = sprite3

I don’t want the control to reprocess and send the rendering of the control three times.
I could build in something like this to prevent the issue:

mySpriteButton.PreventRendering = true mySpriteButton.Sprite = sprite1 mySpriteButton.SpriteHover = sprite2 mySpriteButton.SpritePressed = sprite3 mySpriteButton.PreventRendering = false mySpriteButton.Render?

But the problem with this way is that it makes utilizing the control complicated and difficult to communicate/educate this with others.
Is there possibly a better way around this built in that I’m missing?
Would it be possible to add something into the framework and the WebSDK to mark a WebControl as “dirty” and to have the session only get the changes once?

What you can do is start a timer when the first computed property changes and each subsequent change resets the timer. When it times you can do the render.

We do this for BKS Shorts page rendering.

File a feature request. We could probably figure out a way to add call a render method just before the response is sent.

for the record, the FR is: feedback://showreport?report_id=36839

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.