Closed mh84 closed 3 months ago
I did some further research and found out that the behaviour changed in 0.19 (and i followed this downwards to 0.14.0), where the behavior changed but was also wrong:
One last discovery: when changing the button to function component, it is working as intended.
Not a bug. The renderer re-uses an existing instance of your <Button />
component with updated properties. Yet, you "precompute" its icon and class (and onclick) only in the component's create
. This leads to a wrong and outdated icon being rendered for a component has correctly updated props. Move that logic from create to the view
to fix it.
Alright, i wasn't aware that this would be considered as property change, thanks for explaining this.
Problem I've encountered some strange behavior i'm assuming a bug in yew where elements after updating context not having the correct content, i assume there is some problem with change detection. In my scenario you have a page where you are able to navigate (blue action button "A") or filter the current view (yellow filter button "F"). After filtering, you can go back (blue button "B"). Actually, after filtering using "F" and navigating back using "B" you will see Buttons action "A" and back "b" instead of filter "F".
Steps To Reproduce Reproduction
Expected behavior When using "F" to filter and using "B" to go back after, you see action "A" and filter "F" again.
Screenshots Initial:
Click "F":
Click "B":
![grafik](https://github.com/yewstack/yew/assets/17948500/2fb6e5d2-960d-4c4c-9a84-812e1a802ed8)
Environment:
Questionnaire