2022/07/18/layout-event rubberducking

From Woozle Writes Code
Jump to navigation Jump to search

Now I've got... [counts...] six copies of the header coming up.
More is better, right? <.<
"My code is now 300% more performant."

[1:55 PM]

The Untanglenating continues...

The problem seems to be with elements that have sub-elements, apparently getting rendered via 2 different paths...

Got it back down to two copies, but my brain is just utterly frazzled by how to make this maintainably debuggable.

[7:09 PM]

Maybe it is time to rethink how it works...

[7:13 PM]

Throwing idea-spaghetti at the wall: howbout I have, liek, an XML doc for the page as a whole, and elements of that can refer to other XML docs for sub-elements...

[7:14 PM]

Question from the class: Why is that any better?
Answer: uhhh... you obviously didn't read last night's seven chapters of documentation that I assigned. I forgot? Well, you should have done them anyway. Class dismissed... <runs away>

I think the problem may originate with trying to treat [rendering] more like the other two types of events. It was previously a separate dispatch chain.

[7:40 PM]

This may be another case of I Thought I Was Being Clever.

[7:42 PM]

...cuz I've ended up partly implementing that separate dispatch chain anyway, and sorting that out has been the major cause of the last 10-20+ hours I've spent on this.

[7:44 PM]


  • each element calculates its render output during OnFigure, and stashes that in a variable which can be accessed by, uh, GetRendered() ocelot
  • OnRender() just goes through and sums those up. No other dispatch allowed. (All the dispatching would be during OnFigure().)

That way, we maintain clarity about what's being added to the output and what's just being calculated for something else to use.

Sounds nice in theory...

[7:45 PM]

...but I kinda feel like we'll end up in the same spot, somehow...

[7:48 PM]

Oh, here's one way out of the trap: if a parent-object uses the output of GetRendered(), it can clear that so it won't get used again.

...and actually, let's make it automatic: retrieving the rendered output clears it.

Revisionist documentation...

Okay, I need to figure out what the heck I was trying to do with Kiosk objects...