Using depth with polymorphic relationships / block fields

default discord avatar
jm.sv
last month

Should the

depth

parameter for the Rest API work for polymoprhic relationships and/or block fields as well? I'm struggling to get my block's polymorphic relationship to populate no matter the depth parameter.



I have a

cta-block

on my homepage global and in my project case studies. The

cta-block

has a link field, which (like the payload template) allows for internal and external links. When

internal

, the field is a relation to either my

Pages

collection or

Projects

collection.



I can't get

depth=N

to populate the relation in the link field. It's always just the document ID.



Is this because it's a block field? Or because it's a polymorphic relation? Or is it a bug?

(video

https://share.cleanshot.com/xnv1XBwg

)



Ah nevermind, just realized my

Pages

collection didn't have public access. Added

access: { read: () => true, },

and it's working as expected 🙏

    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.