IdentifierGenerator is not working ideally
Closed this issue · 1 comments
kevindeyne commented
Right now, identifierGenerator works like this:
And that's potentially a little dangerous.
Imagine scenario:
You have two iterations on the same content, as such:
[$foreach $items-bought]
<p>Medusa</p>
[$end]
[$foreach $items-bought]
<p>Medusa</p>
[$end]
The ID would only hash the content, so it would generate the same for both iterations - causing confusion and invalid HTML (id needs to be unique).
But at the same time I need to make sure that no matter how many refreshes you do, it always generates the same ID (otherwise the ConditionalRegistry or IterationRegistry does not have the right reference -> you get a situation where things work until you refresh).
Not sure what the best solution for this is.
dirkdeyne commented
Possible fix in PR #40
Changes:
IterationTag
: usem-id
instead ofid
for the templatewebsocket.js
: loop through each template-element with anm-id
example page: http://localhost:8080/history