mirror of
https://github.com/kusti8/proton-native.git
synced 2026-05-15 22:02:24 -06:00
[GH-ISSUE #148] Children of Picker/RadioButton are naively appended? #92
Labels
No labels
bug
documentation
enhancement
libui issue
pull-request
question
wait for libui implementation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/proton-native#92
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @infiniteluke on GitHub (May 29, 2018).
Original GitHub issue: https://github.com/kusti8/proton-native/issues/148
Hi! Thanks for this great project. I really appreciate you making this oss. Very cool stuff.
I could be missing something here (I'm new to proton-native). I'm seeing strange behavior when a
<Picker />or<RadioButton />'s "Items" are driven by state. It appears their children, when rendered, are simply appended if they're new.The if they're new part seems important but it's the part I understand the least. Wish I had more info here, but I don't. 🤷♂️
Here's an example app that reproduces the issue, by simply adding items to an array, then emptying it:
https://github.com/infiniteluke/proton-native-repro-append-issue
I would expect this to behave like react dom, smartly re-rendering the list using
keys(https://reactjs.org/docs/reconciliation.html#recursing-on-children):Here's a repo demonstrating a similar UI working correctly:
https://github.com/infiniteluke/proton-native-react-dom-comparison
I started looking around and I pinpointed https://github.com/kusti8/proton-native/blob/master/src/components/DesktopComponent.js#L151 which seems like it needs some heuristics around it for removing existing elements at least. If you point me in the right direction, I'd be happy to PR a fix.
@mischnic commented on GitHub (May 29, 2018):
In libui there's only
uiRadioButtonsAppendanduiComboboxAppend(issue: https://github.com/andlabs/libui/issues/309).So any fix needs (for now) to use a workaround like UiSlider does (remove and re-add the component).