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

Live Preview: beforeChange hook not reflected in admin ui #10536

Open
bebejane opened this issue Jan 13, 2025 · 0 comments
Open

Live Preview: beforeChange hook not reflected in admin ui #10536

bebejane opened this issue Jan 13, 2025 · 0 comments
Assignees
Labels
live-preview @payloadcms/live-preview

Comments

@bebejane
Copy link

bebejane commented Jan 13, 2025

Describe the Bug

When applying a beforeChange hook to a collection, changes to the record does not reflect in the ui in Live Preview view.

This was fixed for the Edit view in #10268 but persists in Live Preview mode.

Also, updates of the data in the hook is not received in the the admin.livePreview defined function for generating the preview url. Since the pathname to the page depends on the slug field, it's not possible to construct the correct pathname upon changing the slug.

Also, i'm not sure if this is a bug or intended but when autosave:true is defined in the collection config, changes in hooks are not reflected at all, both in Edit and Live Preview mode.

Link to the code that reproduces this issue

https://github.com/bebejane/payload-hook-bug

Reproduction Steps

  1. Clone
  2. pnpm i
  3. pnpm dev
  4. Go to /admin and create the first user
  5. Go to Posts collection and add a post
  6. See the slug field change upon changing title when saving in edit view
  7. Swich to Live Preview mode
  8. Changes do not update in ui when saving

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

area: ui

Environment Info

Binaries:
  Node: 18.20.4
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: 9.15.0
Relevant Packages:
  payload: 3.16.0
  next: 15.1.4
  @payloadcms/email-nodemailer: 3.16.0
  @payloadcms/graphql: 3.16.0
  @payloadcms/live-preview: 3.16.0
  @payloadcms/next/utilities: 3.16.0
  @payloadcms/payload-cloud: 3.16.0
  @payloadcms/richtext-lexical: 3.16.0
  @payloadcms/translations: 3.16.0
  @payloadcms/ui/shared: 3.16.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
@bebejane bebejane added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 13, 2025
@AlessioGr AlessioGr added the live-preview @payloadcms/live-preview label Jan 14, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jan 14, 2025
@AlessioGr AlessioGr added status: needs-triage Possible bug which hasn't been reproduced yet status: verified If an issue has been reproduced labels Jan 14, 2025
@github-actions github-actions bot removed status: verified If an issue has been reproduced status: needs-triage Possible bug which hasn't been reproduced yet labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
live-preview @payloadcms/live-preview
Projects
None yet
Development

No branches or pull requests

3 participants