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

[Payload 3.0] Missing custom actions in the custom pages #9338

Closed
dinhmai74 opened this issue Nov 19, 2024 · 5 comments · Fixed by #9404
Closed

[Payload 3.0] Missing custom actions in the custom pages #9338

dinhmai74 opened this issue Nov 19, 2024 · 5 comments · Fixed by #9404
Assignees

Comments

@dinhmai74
Copy link

Describe the Bug

The actions views are missing in the custom pages after upgrade to payload 3 latest from beta-126.

Here the clip demo the bug:
https://github.com/user-attachments/assets/ab5e8537-d576-445e-9114-5ca50b42795b

Link to the code that reproduces this issue

https://github.com/dinhmai74/payload-missing-actions

Reproduction Steps

  • go to admin page -> we can see the actions view there
  1. go to the custom page (/admin/custom-views) -> nothing show in the actions position

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Binaries:
  Node: 22.8.0
  npm: 10.8.2
  Yarn: 1.22.21
  pnpm: 9.4.0
Relevant Packages:
  payload: 3.0.0
  next: 15.0.0
  @payloadcms/db-postgres: 3.0.0
  @payloadcms/email-nodemailer: 3.0.0
  @payloadcms/graphql: 3.0.0
  @payloadcms/next/utilities: 3.0.0
  @payloadcms/payload-cloud: 3.0.0
  @payloadcms/richtext-lexical: 3.0.0
  @payloadcms/translations: 3.0.0
  @payloadcms/ui/shared: 3.0.0
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Thu Oct 5 21:02:42 UTC 2023
  Available memory (MB): 31974
  Available CPU cores: 32
@dinhmai74 dinhmai74 added status: needs-triage Possible bug which hasn't been reproduced yet v3 validate-reproduction labels Nov 19, 2024
@kendelljoseph
Copy link
Contributor

@denolfe denolfe removed the v3 label Nov 19, 2024
@dinhmai74
Copy link
Author

@kendelljoseph , what do you mean by that? https://github.com/dinhmai74/payload-missing-actions/blob/main/src/actions.tsx is my actions file. Are there new ways to implement it? As you can see in the demo, it appears on the normal pages but disappears in the custom pages when using the DefaultTemplate componen

@akhrarovsaid
Copy link
Contributor

Hey @dinhmai74,

I think what's happening here is intentional. In Payload admin views, viewActions are provided to the default template by Payload as you would expect - you author them, like you have, and they show up appropriately. However, when you're creating a custom view the responsibility of passing those view actions are yours as Payload is not driving the default view for you. This sounds intentional and expected to me.

You can pass your custom view actions to the default template via the viewActions prop passed directly to the DefaultTemplate component. See here and have a look just below where I linked you to see them used. Hopefully this works for you.

@JarrodMFlesch
Copy link
Contributor

JarrodMFlesch commented Nov 21, 2024

@dinhmai74 I think what @akhrarovsaid said is correct, you could recreate these yourself but you would incur some overhead by re-running a function we already run. I have opened #9404 which will allow your custom component to receive viewActions as a prop that you will then need to pass to your DefaultTemplate server component.

@kendelljoseph
Copy link
Contributor

@kendelljoseph , what do you mean by that? https://github.com/dinhmai74/payload-missing-actions/blob/main/src/actions.tsx is my actions file. Are there new ways to implement it? As you can see in the demo, it appears on the normal pages but disappears in the custom pages when using the DefaultTemplate componen

My mistake - the file was there!

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Nov 21, 2024
@JarrodMFlesch JarrodMFlesch self-assigned this Nov 21, 2024
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 a pull request may close this issue.

5 participants