Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Genesis widget always re-renders on first refresh cycle #8871

Open
saqimtiaz opened this issue Dec 26, 2024 · 2 comments
Open

[BUG] Genesis widget always re-renders on first refresh cycle #8871

saqimtiaz opened this issue Dec 26, 2024 · 2 comments

Comments

@saqimtiaz
Copy link
Member

saqimtiaz commented Dec 26, 2024

A genesis widget with non-$-prefixed attributes will always re-render itself and its contents on the first refresh cycle. This is because in the render method, the widget only computes the attributes starting with $. As a result, the first time the widget's refresh method is run, computeAttributes() returns false positives for all attributes not starting with $ suggesting that they have changed. The refresh method should also ignore all attributes not prefixed with $.

To test:

  1. create tiddler A with the text
<$genesis type="div">
<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>>

</$genesis>
  1. Click the new tiddler button and watch the display of tiddler A update.
@pmario
Copy link
Member

pmario commented Jan 7, 2025

@saqimtiaz ... There are also parameters with $$ prefix. IMO they have the same problem.

@Jermolene ... Can you remember, why you did restrict this.computeAttribute for the genesis-widget in the first run?

@Jermolene
Copy link
Member

@Jermolene ... Can you remember, why you did restrict this.computeAttribute for the genesis-widget in the first run?

Yes, the reason it is done is because we only want to compute the values of the attributes that are actually used by the genesis widget itself. We handle the other attributes that are to be passed directly onto the created widget by copying the parse tree nodes themselves. The values of those attributes will be computed when that created widget is instantiated.

In other words, it is to avoid computing an expensive filtered attribute twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants