Closed eunjae-lee closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
plugin-sandbox | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Aug 22, 2023 3:24pm |
Nice job @eunjae-lee, thanks.
I added some ideas but nothing is required to change.
Is there a need for updating the 'demo' application too, though?
Nice job @eunjae-lee, thanks.
I added some ideas but nothing is required to change.
Is there a need for updating the 'demo' application too, though?
oh we actually need to update the container just like I did to Storyfront: https://github.com/storyblok/storyfront/pull/4368
The changes look good to me @eunjae-lee. Nice job 🚀
What?
The corresponding pull request in Storyfront is a prerequisite: https://github.com/storyblok/storyfront/pull/4368
This PR makes the following changes
callbackId
in theassetModalChangeMessage
that is sent to StoryfrontassetFromAssetSelectedMessage
message, the library comparescallbackId
withinassetFromAssetSelectedMessage
and the originalcallbackId
.Okay, but why ignore it instead of rejecting the promise?
Let's assume there is a field plugin that has called
createFieldPlugin()
twice.Technically
selectAsset
can be called simultaneously because the asset selector will pop up as a modal and user won't be able to triggerselectAsset
at the same time. However, let's assume that's somehow done programmatically.The asset selector modal is up by
plugin1
, and user selects an asset. Now the message is delivered viapostMessage
. Bothplugin1
andplugin2
will receive this message, because both plugins are listening tomessage
event. By comparing thecallbackId
, we know it's originated fromplugin1
. So we execute the callback forplugin1
. However, what aboutplugin2
? It may have started its own asset selection process in the meantime, so we shouldn't already reject its callback yet. Let it stall. That's why the unit test doesn't check if it gets rejected, but it checks it's neither resolved nor rejected after some time out.JIRA: EXT-1916
How to test? (optional)