You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a custom page is rendered , it is necessary to keep its shallow children in memory due to needing to know which conditionals change.
So to more efficiently do this, only store the hash values of the shallow conditionals as a string.
Conditionals
...varbody:somePage{Div{
if toggle {H1("My Title")}
if toggle2 {H2("subtitle")
if toggle3 {H3("Third Head")}}}}...
previously the entire body page was store but now could get away with only storing
// 0 is a false conditional , 1 is true conditional, -1 if false no else clause, else if is a bit more complex but still unique// toggle = false, toggle2 = false, toggle3 = ANYTHING"(0,0)"// toggle = false, toggle2 = true, toggle3 = false"(0(1,0))"// toggle = true, toggle2 = true, toggle3 = true"(1(1,1))"
For-Loop
...varpeople:[String]=["Jeff","Josh","Todd","Emma","Jessica","Tom"]varbody:somePage{Div{
for person in people {H2(person)}}}...
by default the id for a for loop is the .count amount of elements
"([6])"
...varpeople:[String]=["Jeff","Josh","Todd","Emma","Jessica","Tom"]varbody:somePage{Div{
for person in people {H2(person).key(person)}}}...
use .key to create a custom key and the new id gets a bit more complicated
"([Jeff,Josh,Todd,Emma,Jessica,Tom])"
Complex Example
...varpeople:[String]=["Jeff","Josh","Todd","Emma","Jessica","Tom"]varbody:somePage{Div{
if toggle {H1("My Title")}
for person in people {H2(person)}
if toggle2 {
if toggle3 {H2("subtitle")}
if toggle4 {
for person in people {H2(person).key(person[0])}}}}}...
When a custom page is rendered , it is necessary to keep its shallow children in memory due to needing to know which conditionals change.
So to more efficiently do this, only store the hash values of the shallow conditionals as a string.
Conditionals
previously the entire body page was store but now could get away with only storing
For-Loop
by default the id for a for loop is the .count amount of elements
use .key to create a custom key and the new id gets a bit more complicated
Complex Example
Problems
what happens in the case below the id would stay the same for a for loop but it should change
Consider hashing in base32 so there are no commas?
The text was updated successfully, but these errors were encountered: