templates: allow to pass resource={null} to Media component (#11228)

The `Media` component has an optional property `resource` so we can skip
that property. As in payload `required: false` types are generated like
`media?: Media | string | null`, it also makes sense to allow `null` as
a `resource` value.

Fixes https://github.com/payloadcms/payload/issues/11200
This commit is contained in:
Sasha
2025-02-17 19:44:10 +02:00
committed by GitHub
parent d126c2bf80
commit 64d0217456
3 changed files with 3 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ export interface Props {
onLoad?: () => void
priority?: boolean // for NextImage only
ref?: Ref<HTMLImageElement | HTMLVideoElement | null>
resource?: MediaType | string | number // for Payload media
resource?: MediaType | string | number | null // for Payload media
size?: string // for NextImage only
src?: StaticImageData // for static media
videoClassName?: string

View File

@@ -14,7 +14,7 @@ export interface Props {
loading?: 'lazy' | 'eager' // for NextImage only
priority?: boolean // for NextImage only
ref?: Ref<HTMLImageElement | HTMLVideoElement | null>
resource?: MediaType | string | number // for Payload media
resource?: MediaType | string | number | null // for Payload media
size?: string // for NextImage only
src?: StaticImageData // for static media
videoClassName?: string

View File

@@ -14,7 +14,7 @@ export interface Props {
loading?: 'lazy' | 'eager' // for NextImage only
priority?: boolean // for NextImage only
ref?: Ref<HTMLImageElement | HTMLVideoElement | null>
resource?: MediaType | string | number // for Payload media
resource?: MediaType | string | number | null // for Payload media
size?: string // for NextImage only
src?: StaticImageData // for static media
videoClassName?: string