-
Notifications
You must be signed in to change notification settings - Fork 884
Description
Hi team,
We are integrating emoji-mart v5 Web Component Picker into our React application with a dynamic custom search filtering logic. Our goal is to:
Dynamically filter emojis based on user input (searchValue)
Pass exceptEmojis to hide unwanted emojis from the picker dynamically
Avoid using the internal search input and instead control visible emojis ourselves
βοΈ Problem
Currently:
When we update exceptEmojis the picker does not re-render.
We tried:
Destroying and recreating the picker instance
Calling init({ data }) again with modified data
Using a wrapper component with dynamic keys to force remount
However, the picker always uses the previously cached emoji data (SearchIndex global singleton). Even after:
await init({ data: newData });
The picker displays the previous data, not the updated filtered data.
reset() on SearchIndex empties the index and disables search altogether.
π¬ Expected Behavior
When passing updated data or a new exceptEmojis prop, we expect:
The picker to re-render with updated visible emojis
The SearchIndex or internal data cache to reset and rebuild based on new data
π Observed Behavior
Picker only uses the first initialized data
Changes in exceptEmojis or data do not reflect without a full page reload
Because of this singleton cache behavior:
We cannot implement dynamic filtering use cases
Users see stale emojis after changing filters or search input
π‘ Possible Solutions
We understand that the Web Component uses a global singleton. Potential solutions could be:
Exposing a forceReinit() method to reinitialize the SearchIndex with new data
Allowing the Picker to accept a data prop reactively
Documenting the limitation explicitly and suggesting recommended patterns for dynamic search & filtering without internal search input
β
Environment
emoji-mart version: v5.6.0
Framework: React (using as Web Component)
π Request
Could you please advise:
Is there an officially supported way to dynamically update emojis shown in Picker?
Or should we fallback to building a custom emoji grid with emoji-mart data for this use case?
Thank you for the amazing library. Looking forward to your guidance to implement this feature optimally.