Async Mentions #1281
-
It would be great if there were examples on how to implement async logic. I was trying to figure out Mentions and Images but haven't been able to make them work with calls to my Backend. Also, I wanted to ask this on Slack, but there's no way to get in. I clicked on the link but you have to be in the org already, where do you get an invitation? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Did you try this slack link? https://join.slack.com/t/slate-js/shared_invite/zt-f8t986ip-7dA1DyiqPpzootz1snKXkw |
Beta Was this translation helpful? Give feedback.
-
@Samushel I've been fighting trying to get my head around this new store setup and what's a component prop and what you need to go to the store for. It's a very different pattern to anything I'm used to, but I htink it's for the better once I get my head around it. With some assistance from @zbeyens regarding the use of comboboxStore.use.isOpen & comboboxStore.use.text, I was able to throw this together. I think it should get you someway towards being able to control the items through an async call. Haven't quite got the combobox filter function to fire yet, I did have it working in 6.x but seems to not be working now in 7.x. I was using that to filter out mentions in the list that were already selected, but possibly v7 does this automatically.
|
Beta Was this translation helpful? Give feedback.
-
Thought I'd just post a quick update to this as I've discovered a few gotchas in the way the combobox store works. It was a bit confusing at first between what is essentially shared values between all comboboxes and what is stored per plugin. The advice to use comboboxstore.use.open and .text actually resulted in all my combo boxes firing their searches and other functionality. It wasn't until looking into the source code of combobox that I discovered it was filtering itself based on activeId. At first I thought that's ok I don't need to pull that up to my component as combobox is already doing it. But if like above you are firing something off based on open and text (in my case above I want to fetch the first 5 mentions when they type @ without waiting for first letter to search on), that fires on all components accessing the store.use. to get around it if you are using a component like above. you need to add something like this in to check it really is open
|
Beta Was this translation helpful? Give feedback.
-
I'm trying to use the MentionPlugin and make async call to my server in order to refetch items based on the search text. I tried to use the solution above but a lot of things seems changed from this answer. Could please someone show me the right way to achieve my goal? Many thanks! |
Beta Was this translation helpful? Give feedback.
Thought I'd just post a quick update to this as I've discovered a few gotchas in the way the combobox store works. It was a bit confusing at first between what is essentially shared values between all comboboxes and what is stored per plugin. The advice to use comboboxstore.use.open and .text actually resulted in all my combo boxes firing their searches and other functionality. It wasn't until looking into the source code of combobox that I discovered it was filtering itself based on activeId. At first I thought that's ok I don't need to pull that up to my component as combobox is already doing it.
But if like above you are firing something off based on open and text (in my case above I w…