You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
however, when I turn on live preview, all the data will be there except the populatedAuthors key, because it is populated by a hook, and that hook works after read, and it seems useLivePreview from @payloadcms/live-preview-react doesn't execute the hooks (or at least cache their results).
To Reproduce
Create an afterRead hook.
The useLivePreview function doesn't execute the hooks, so the authors never get updated and is returned as null. It would be useful to cache the result of the previous run and merge it with the result from useLivePreview, or at least simulate the hook being re-run after each edit to avoid some network+database requests.
Payload Version
3.0.0-beta.18
Adapters and Plugins
@payloadcms/live-preview-react
The text was updated successfully, but these errors were encountered:
Link to reproduction
No response
Describe the Bug
I have a collection named
Posts
where I have a hook like the following:however, when I turn on live preview, all the data will be there except the
populatedAuthors
key, because it is populated by a hook, and that hook works after read, and it seemsuseLivePreview
from@payloadcms/live-preview-react
doesn't execute the hooks (or at least cache their results).To Reproduce
Create an afterRead hook.
The
useLivePreview
function doesn't execute the hooks, so the authors never get updated and is returned as null. It would be useful to cache the result of the previous run and merge it with the result fromuseLivePreview
, or at least simulate the hook being re-run after each edit to avoid some network+database requests.Payload Version
3.0.0-beta.18
Adapters and Plugins
@payloadcms/live-preview-react
The text was updated successfully, but these errors were encountered: