Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: warn when using defaultPopulate on collections with an upload field. #10138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PlagueFPS
Copy link

When defaultPopulate is enabled without specifying filename: true and url: true for collections with an upload field. The upload will not have a valid URL when returned from Payload APIs and will instead be returned with a value of null

… field.

This is an important note as without specifying both `filename: true` and `url: true` Payload APIs will return `url: null` for uploads.
docs: add important warning for using `defaultPopulate` on collections with an upload field.
Comment on lines +140 to +144
<Banner type="warning">
<strong>Important:</strong>
When using `defaultPopulate` on collections with a [Upload](/docs/fields/upload) field, it is important to specify `filename: true` and `url: true`, otherwise Payload will not be able to fetch the correct image URL and populate the URL field in your queries, instead returning `url: null`.
</Banner>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think

on collections with a Upload field,

Is confusing as you probably mean using it on collections that have enabled uploads https://payloadcms.com/docs/upload/overview, not on upload fields.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is what I meant, messed up the wording.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants