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
While I was exploring the possibility of minimising the binary size of (my version of) the js-framework-benchmark for leptos framework, I ran into a problem where the "swap rows" button didn't work in debug mode. It turns out it only works in release mode. 😬
I have now found the issue which seems to be related to the function EachItem.get_opening_node which work differently in release and debug mode. In debug mode, the opening node is always a Comment type node. In release mode it's a normal Element type node. In debug mode, later when mount_child(MountKind::Before(&opening), &each_item); is called to insert the nodes at the right positions, it does not work because opening is a comment node. Changing the behavior of get_opening_node to work the same as release in mode fixes this problem.
Because I don't know the intent of having different implementations of get_opening_node, I decided not to open a pull request of my "fix". However, I still think this issue needs to be resolved, since a broken DiffOpMove implementation in debug builds are unacceptable.
Thanks. The <For/> component is toward the tail end of a significant rewrite by @jquesada2016 (see #533, #897), which will likely resolve this issue in any case.
In the meantime, if you have a solution please do open a PR so we can test it.
Edit: Had my brain off for a second, I see your solution included in the issue here and have tested it and it does seem to work here. I'll test it against some other cases. Thanks.
While I was exploring the possibility of minimising the binary size of (my version of) the js-framework-benchmark for leptos framework, I ran into a problem where the "swap rows" button didn't work in debug mode. It turns out it only works in release mode. 😬
I have now found the issue which seems to be related to the function
EachItem.get_opening_node
which work differently in release and debug mode. In debug mode, theopening
node is always aComment
type node. In release mode it's a normalElement
type node. In debug mode, later whenmount_child(MountKind::Before(&opening), &each_item);
is called to insert the nodes at the right positions, it does not work becauseopening
is a comment node. Changing the behavior ofget_opening_node
to work the same as release in mode fixes this problem.Because I don't know the intent of having different implementations of
get_opening_node
, I decided not to open a pull request of my "fix". However, I still think this issue needs to be resolved, since a brokenDiffOpMove
implementation in debug builds are unacceptable.This is the change I did to "fix" the issue:
leptos_dom/src/components.rs
leptos_dom/src/components/each.rs
The text was updated successfully, but these errors were encountered: