Fix publishedAt field: hook bug, standardize config, remove misleading description#1091
Draft
busbyk wants to merge 3 commits into
Draft
Fix publishedAt field: hook bug, standardize config, remove misleading description#1091busbyk wants to merge 3 commits into
busbyk wants to merge 3 commits into
Conversation
- Fix populatePublishedAt hook clobbering user-provided dates on update - Standardize publishedAt to dayAndTime picker on Pages and HomePages (matching Posts) - Remove misleading description from Pages publishedAt field that incorrectly claimed the field affects page visibility Fixes #878 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Unit tests cover the populatePublishedAt hook: auto-set on create, preserve user dates, clear on unpublish, edge cases. E2e tests verify the field renders with dayAndTime picker on Posts and Pages, user-set dates persist across save/reload, and the misleading description is removed from Pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Preview deployment: https://fixxpublished-at-field-issues.preview.avy-fx.org |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issues
Fixes #878 (items 1, 3, 4 - item 2 is a Payload core bug)
Supersedes #1089 (closed), Closes #1087 (duplicate of #878)
Key Changes
src/hooks/populatePublishedAt.ts- Restructured update logic to preserve user-provided datessrc/collections/Pages/index.ts- Added dayAndTime picker, removed misleading descriptionsrc/collections/HomePages/index.tsx- Added dayAndTime pickersrc/payload-types.ts- Regenerated (removed stale description comment)__tests__/server/populatePublishedAt.server.test.ts- 7 unit tests for all hook code paths__tests__/e2e/admin/collections/published-at.e2e.spec.ts- 5 e2e tests for field behaviorHow to test
Unit tests:
pnpm test -- __tests__/server/populatePublishedAt.server.test.tsE2e tests:
pnpm exec playwright test __tests__/e2e/admin/collections/published-at.e2e.spec.tsManual: Edit a published post date (should persist), unpublish (clears after reload), check dayAndTime picker on Pages/HomePages.
Migration Explanation
No migration needed - field admin config changes only.
Future enhancements / Questions