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

Missing "id" property in adminThumbnail's doc parameter #6430

Open
DrMint opened this issue May 19, 2024 · 0 comments
Open

Missing "id" property in adminThumbnail's doc parameter #6430

DrMint opened this issue May 19, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@DrMint
Copy link

DrMint commented May 19, 2024

Link to reproduction

No response

Describe the Bug

I've created an upload collection where I've set disableLocalStorage to true. I'm using the afterChange and afterDelete to send fetch requests to another service which handles storing and resizing the images for me.
I've decided to use the document's id as part of the URL to access the image on this third party service.

To display the image's thumbnail in Payload's admin UI, I'm wanted to use the adminThumbnail property in the collection config, to generate the URL to this third party service. However, this cannot be achieved because the id property is missing in the doc parameter of the adminThumbnail function (the type is GetAdminThumbnail["doc"]).

I'm not sure if this is a bug or a feature request.

I've made a quick and dirty patch (which doesn't seem to work when running the dev server, only when running build and serve):
payload+2.18.3.patch.txt

To Reproduce

  • Create an upload collection
  • In the collection's config set the property upload.adminThumbnail to the following:
    ({ doc }) => {
        console.log(doc);
        return doc.url;
    },
  • Now run the payload server, connect to it and create an entry in this collection.
  • In the dev console you should see the content of doc which seem to reflect the current state of the edit view but not the actual properties of the document:
    {
      "url": "REDACTED",
      "width": 359,
      "height": 359,
      "focalX": 50,
      "focalY": 50,
      "filename": "REDACTED",
      "mimeType": "image/png",
      "filesize": 126516,
      "updatedAt": "2024-05-19T23:20:13.943Z",
      "createdAt": "2024-05-19T22:22:06.297Z"
    }
    

Payload Version

2.18.3

Adapters and Plugins

"@payloadcms/bundler-webpack": "1.0.6", "@payloadcms/db-mongodb": "1.5.1", "@payloadcms/richtext-lexical": "0.11.1", "payloadcms-sftp-storage": "1.0.1",

@DrMint DrMint added the status: needs-triage Possible bug which hasn't been reproduced yet label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant