Custom Fields
Re-Envisioned
Support General Gutenberg Sidebar Media Upload Clash with image_advanced

This topic contains 7 replies, has 2 voices, and was last updated by  latlong 2 months, 3 weeks ago.

  • Creator
    Topic
  • #14998
    Resolved
    latlong
    Participant

    We’ve uncovered an issue with Gutenberg media uploads clashing with the image_advanced fields that is very similar to what was reported and diagnosed here: https://metabox.io/support/topic/error-with-image-advanced-in-gutenberg/

    When uploading media from controls in the sidebar, the next instances of image_advanced fields on the page have their values removed once an image is selected from another MediaUpload component.

    While that previous ticket dealt with Gutenberg media uploads from within the editor, we’re seeing the same behavior for media upload controls that exist within a block’s “Inspector” sidebar. I’ve verified that we are testing with the latest MB version which contains the code solution described in that thread.

    You can see it in acton in this demo gif:

    Upload clash demo

    In this demo, the “Product Images” panel below the editor is created with MetaBox and both the “Lifestyle Thumbnail Image” and “Studio Thumbnail Image” fields are image_advanced.

    It seems like the Backbone media collections are not unique for MetaBox and Gutenberg so the ‘removed’ event is firing when the WordPress media select window is opened.

    The sidebar media upload buttons are being added with the standard MediaUpload component

    Happy to PM login information to a staging environment or provide any further debug details we can.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #15010

    Anh Tran
    Keymaster

    Hi @latlong,

    That’s exactly the problem in the topic you mentioned above. The problem is media items (models) used in Gutenberg and our Backbone collection are shared (the WP’s API does that). And Gutenberg clears the collection (which removes the items) when selecting another image (which is weird, since in the classic editor, it doesn’t happen). I’m still looking for a fix.

    #15055

    latlong
    Participant

    Anything we can do to assist, let me know. It’s causing a few headaches on a live enterprise project, so we’re happy to fund some development time, devote dev time of our own (with guidance) or help with testing if we can be useful.

    Thanks!

    #15063

    Anh Tran
    Keymaster

    I’m reviewing a fix on Github that you can try for now:

    https://github.com/wpmetabox/meta-box/pull/1316

    In my test, it seems to work well.

    #15090

    latlong
    Participant

    Gave this PR a test drive yesterday; unfortunately, it didn’t change the behavior in our context. But we’re going to spend some time on it this week and see if the approach taken in that solution can lead us to some success

    #15100

    Anh Tran
    Keymaster

    FYI, I’ve just merged the code into the master branch on Github. If you have time, please try it:

    http://github.com/wpmetabox/meta-box/

    #15125

    Anh Tran
    Keymaster

    @latlong: There is an updated fix on this, can you try the latest version on Github?

    #15171

    latlong
    Participant

    Quick tests yesterday worked great! Giving it a bit more thorough QA today and tomorrow to confirm, but first checks look good

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.