Skip to content

fix(ui): use latest server response when resetting form after unpublish#16762

Open
raunak3208 wants to merge 2 commits into
payloadcms:mainfrom
raunak3208:fix-unpublish-stale-form
Open

fix(ui): use latest server response when resetting form after unpublish#16762
raunak3208 wants to merge 2 commits into
payloadcms:mainfrom
raunak3208:fix-unpublish-stale-form

Conversation

@raunak3208
Copy link
Copy Markdown

What?

Updates the Unpublish button form reset flow to use the latest server response instead of stale dataFromProps.

Why?

When beforeChange hooks modify field values during unpublish (e.g. setting publishedAt to null), the database updates correctly but the admin UI continues showing stale values until a manual reload.

This happened because the form was being reset using the initial page data instead of the updated response returned by the server.

How?

After a successful unpublish request, the response body is now parsed with res.json() and passed to resetForm, ensuring the form reflects the latest persisted document state.

Fixes #16754

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 this pull request may close these issues.

REST: /api/media/file/* returns 404 on HEAD but 200 on GET (RFC 9110 §9.3.2 violation)

1 participant