-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
loosing state since commit 78d4204a9a52a826bd2be4e7383d29e04233fb5b #2654
Comments
I notice that you don't use keys. Does it work with them? You'd need them for semantic guarantees like node identity. |
Adding keys does not help ... |
The VList claims that it is not fully keyed ( |
OK, it works with fuilly_keyed: true But you cant expect that every child has a key?? At least it worked without in 0.19.3 |
If you care about exact node identity, then yes, I do, for now. Feel free to contribute a smarter list reconciliation algorithm, the current one was changed slightly for performance reasons, which is why behaviour changed, but fully keyed lists were always required to get any benefit from keys at all and without them, it was never guaranteed to work, as far as I can see. It just did because the nodes lined up for the old alg or something like that. All of this is moot when the vlist length doesn't change and items line up. Strictly speaking the exact behaviour is also not guaranteed, but I don't see why it would make sense to replace nodes in this case, for the unkeyed internal alg, in any situation, so it's safe enough to "trust" that implementation detail. There are some actionable items though, I can see (in increasing order of difficulty):
|
It would be great if we can really trust on this behavior (instead of "trust" on an implementation detail). |
I create VTag manually using the builder pattern.
This worked unless commit 78d4204.
My Vtag contains 2 children:
VTag { inner: Other { tag: "div", children: VList { children: [VComp { type_id: TypeId { t: 18257190933183877322 }, node_ref: NodeRef { references: None }, mountable: "..", key: None }, VComp { type_id: TypeId { t: 5180764447731008823 }, node_ref: NodeRef { references: None }, mountable: "..", key: None }], fully_keyed: false, key: None } }, listeners: Pending([]), node_ref: NodeRef { references: None }, attributes: IndexMap({Static("class"): Rc("pwt-fit pwt-panel")}), key: None }
I then append another child:
VTag { inner: Other { tag: "div", children: VList { children: [VComp { type_id: TypeId { t: 18257190933183877322 }, node_ref: NodeRef { references: None }, mountable: "..", key: None }, VComp { type_id: TypeId { t: 5180764447731008823 }, node_ref: NodeRef { references: None }, mountable: "..", key: None }, VComp { type_id: TypeId { t: 15011471947742392350 }, node_ref: NodeRef { references: None }, mountable: "..", key: None }], fully_keyed: false, key: None } }, listeners: Pending([]), node_ref: NodeRef { references: None }, attributes: IndexMap({Static("class"): Rc("pwt-fit pwt-panel")}), key: None }
This results in a complete redraw, i.e. the first 2 children gets re-created, so they loose all state.
Please note that this does not happen when using the html macro, because the html macro always generates the same number of children (using an empty VLIst for optional children).
The text was updated successfully, but these errors were encountered: