Publishing clears relationship fields

default discord avatar
zoul0813
2 weeks ago
6

I've upgraded to 1.15.4 (ran migration, enabled queryDraft_2_0)


After the upgrade, it seems that Publish Changes is clearing two of my relationship fields ('tags' and 'products') when the editor refreshes. The content is properly published, but these fields are cleared on admin update. If I refresh the admin, the fields are correctly populated. If I edit the document more, and try to publish while these fields are cleared I get the error "field has the following invalid selections: [object Object]: 0"



I've rolled back to 1.15.3 and the problem is resolved - this appears to be related to the changes made here:

https://github.com/payloadcms/payload/commit/5096c378743f4c5eb5f4f2f7e67e5e206cc9da40
  • default discord avatar
    integra9657
    2 weeks ago

    I have the same problem only with hasMany relations after saving more than once without leaving the page. Noticed first in 1.6.9 and the problem still happens in 1.15.2/3/4 with new db.

  • default discord avatar
    zoul0813
    2 weeks ago

    it looks like the update in 1.15.4 doesn't account for arrays when setting the values of the relationship - I don't know enough to open a PR to fix it ...

  • default discord avatar
    integra9657
    2 weeks ago
  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 weeks ago

    Yep I can fix, thank you all for reporting!



    Definitely by EOD Monday, possibly before bc it saddens me



    PR to fix this has been opened:

    https://github.com/payloadcms/payload/pull/3300
  • default discord avatar
    zoul0813
    2 weeks ago

    @jarrod_not_jared thanks - ETA for when this will make it into a release?

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 weeks ago

    @zoul0813 Just released!

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.