Skip to content

Commit

Permalink
Cleanup after #649
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Sep 29, 2024
1 parent b35174c commit 017964f
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/editor/src/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,18 @@ export default function uploadMedia(
>[ 0 ][ 'onFileChange' ];
}
) {
// @ts-ignore -- invalidateResolution is not yet exposed in GB types.
const { invalidateResolution, invalidateResolutionForStoreSelector } =
dispatch( coreStore );
// @ts-ignore -- invalidateResolution missing from types.
const { invalidateResolution } = dispatch( coreStore );

originalUploadMedia( {
...args,
onSuccess: ( attachments ) => {
for ( const media of attachments ) {
if ( media.id ) {
// FIXME: Needs testing.
void invalidateResolution( 'getMedia', [
media.id,
{ context: 'view' },
] );
void invalidateResolution( 'getMedia', [
media.id,
{ context: 'edit' },
] );
void invalidateResolutionForStoreSelector( 'getMedia' );

// TODO: Trigger new call here.
}
}
args.onSuccess?.( attachments );
Expand Down

0 comments on commit 017964f

Please sign in to comment.