Recent emojis state update improvement#238
Conversation
|
@Fintasys could you please review this PR? |
|
Thanks for you PR 🙇
I think the current existing logic is fine. If your build method is triggered for other reasons (which is fine) it shouldn't affect the EmojiPicker as stateful widget. Did you try to find the root cause of this strange behavior? |
The problem is that the logic is inconsistent. In some cases, it updates the list in the state, but doesn't update the UI. In other cases, it updates both the state and UI by calling
It will affect the EmojiPicker because Recent Emojis list is getting updated with |
|
I have the same issue, that my parent widget updates the state, causing the recent emoji list to be updated. This PR solves my issue, after I added the following missing import to
|
This improvement gives more control over recent emojis list updates in widget's state.
Now user can set
recentEmojisUpdatePolicyparameter inCategoryViewConfigto define whether recent emojis list in the widget's state should update:never- never updates the list forRecenttabnotFromRecent- updates the list only when selected emoji is NOT fromRecentcategoryalways- always updates the list.I added this improvement because even though there was a logic to skip
setState()calls when selected emoji is fromRecentcategory, my widget'sbuild()can sometimes be triggered from the parent widget. This was leading to strange behaviour.