missive / emoji-mart

🏪 One component to pick them all
https://missiveapp.com/open/emoji-mart
MIT License
8.37k stars 802 forks source link

ExceptEmojis attribute not working #788

Open oinochoe opened 1 year ago

oinochoe commented 1 year ago
<Picker exceptEmojis={['japanese_goblin']}></Picker>

I wrote right that, but not working this attribute. please tell me why. I use this version.

"emoji-mart": "^5.5.2",
"@emoji-mart/data": "^1.1.2",
"@emoji-mart/react": "^1.1.1",
j4hangir commented 1 year ago

I looked at the code, it seems partially implemented but if you search for the emoji it will still show up.

oinochoe commented 1 year ago

I looked at the code, it seems partially implemented but if you search for the emoji it will still show up.

@j4hangir yeah, i can see the emoji disappear in the list, but it still show whenever searching. I wonder if it was this module's intention.

j4hangir commented 1 year ago

It should be excluded everywhere. I'd say it's overall poorly implemented, for one there isn't much point of passing emoji.id where one can simply pass the emoji itself.

I would do a PR when I get back to it.

EtienneLem commented 1 year ago

This is most likely because init is called beforehand with data, is that possible? including the exceptEmojis in the init call would resolve this issue (for now):

init({ data, exceptEmojis: ['japanese_goblin'] })

This is caused by the fact that we try to limit having to process all the data all the time; we don’t recreated the search index on every mount. That being said, it wouldn’t be too hard to detect when the search should be recreated, we already have some checks in place.

I'd say it's overall poorly implemented, for one there isn't much point of passing emoji.id where one can simply pass the emoji itself.

I don’t see how it would be better from a performance perspective. For most people, the emoji object itself isn’t stored / known before initializing a picker.

j4hangir commented 1 year ago

@EtienneLem in my case it's passed when doing init(), and it's excluded, but when searching still pops up.

Excluding emojis as they're written is way more intuitive, I'd pass a list like ['❄️', '🍾'], for instance them being the given reactions to narrow down the choices, yet with the current implementation I'd need to find out what their IDs are as an extra unnecessary step.

Even the name is chosen badly tbh, it should simply be exclude imo.

oinochoe commented 1 year ago

Even the name is chosen badly tbh, it should simply be exclude imo.

I agree with this.

@EtienneLem I solved the problem. but I think that "Readme" needs to be updated. Thanks 😄

denisveli commented 2 months ago

@oinochoe How did you solved the problem?

oinochoe commented 2 months ago

@oinochoe How did you solved the problem?

@denisveli https://github.com/missive/emoji-mart/issues/788#issuecomment-1412991040 https://github.com/missive/emoji-mart/issues/788#issuecomment-1416786959

I solved this issue via comments above.