Steps to reproduce:
The same happens if I choose to change the featured image in a post immediately after selecting some items in the media library.
The expected behavior is that selections are cleared before opening the featured image and site icon modals - these modals don't accept selection of multiple items.
Hi @nosolosw I'd like to try this one. Is there anyone working on it already?
Not that I know of @sabrown84 Go for it!
@nosolosw I think I understand what the expectations are for this one. Do you have any suggestions on where to start to solve this?
That's great! I don't have any suggestions off the top of my head. Are you familiar with the Flux stores in place? If you haven't the chance yet, you may want to check our approach to data and Media specific stores.
@nosolosw I am having trouble trying to fix this because I'm pretty new to React. Trying to clear the selections, but should I work on this through the Media specific stores or the Media-modal ?
I'm pretty new to this codebase but having fun exploring :) I can submit a patch, but I don't want to step on @sabrown84 toes if she's still working on it (please feel free to do so based on my investigations if you'd like to)!
I can see 2 ways to solve this which I believe is what @sabrown84 was getting at....
1) Currently EditorMediaModal clears the selected items in componentWillMount. Seems to be a problem in that logic there (or the reducer) as the view becomes null in this workflow (as a call to resetModalView action is made and the clear only happens if it's ModalView.LIST. and the SiteIconSetting doesn't specify the view prop.
2) Alternatively, the Media component when unmounted could clear all selections - I'm not sure however if persisting selected across views is intentional however.
Solution 1 seems to make sense to me - I think this is an error in EditorMediaModal. It can be fixed either by checking if the view prop is null; checking the single prop or making it impossible for this to be null. The single prop seems to make the most sense to me (I'm not sure why view matters in this context... ).
Closing as resolved in https://github.com/Automattic/wp-calypso/pull/22118.