Skip to content

Currently selected featured image gets duplicated in amf generated media library #70

@shubham-grazitti

Description

@shubham-grazitti

I encountered an issue while trying to replace a featured image in WordPress. When I navigate to the media library generated by AMF, and select a new image, the current featured image gets added/duplicated to the AMF media library.

Steps to Reproduce:

  1. Add a featured image to a post (it could be from the local library or the AMF-generated library).
  2. Click on the "Replace" Featured Image button.
  3. Navigate to the AMF-generated media library.
  4. Select a new image from the library.

I am assuming this is related to Wordpress as I can see js events are generating the li item(currently selected featured image item) to the library are written in Wordpress.

Is there any way I can fix this?

I have tried resetting the current selection when the media dialog is opened, but it doesn't seem to work

wp.media.featuredImage.frame().on('open', function() {
      const frame = wp.media.featuredImage.frame();
      const selection = frame.state().get('selection');
      selection.reset();
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions