Skip to content

Comments

fix: URLField query param handling and improve PublishedAt merging#416

Merged
ainsleyclark merged 1 commit intoclaude/add-payload-helper-fields-dfM5Cfrom
claude/deep-merge-published-at-GT9t1
Feb 17, 2026
Merged

fix: URLField query param handling and improve PublishedAt merging#416
ainsleyclark merged 1 commit intoclaude/add-payload-helper-fields-dfM5Cfrom
claude/deep-merge-published-at-GT9t1

Conversation

@ainsleyclark
Copy link
Contributor

Summary

This PR improves the robustness of field helpers by fixing URL query parameter handling in URLField and refactoring PublishedAt to use deep merging for overrides. Additionally, it exports these field helpers from the common index for easier access.

Key Changes

  • URLField: Fixed draft parameter appending to properly handle URLs that already contain query parameters using the URL API instead of string concatenation
  • PublishedAt: Refactored to use deepMerge utility for combining base field configuration with user overrides, ensuring nested properties like admin.date are preserved rather than replaced
  • Exports: Added PublishedAt and URLField to the common index exports for improved discoverability
  • Tests: Updated PublishedAt test expectations to reflect the new deep merge behavior, ensuring admin overrides are properly combined with defaults

Implementation Details

  • The URLField now uses the native URL and URLSearchParams APIs to safely append the draft parameter, preventing malformed URLs when query parameters already exist
  • PublishedAt now properly merges admin configuration overrides with default settings (like pickerAppearance: 'dayOnly') instead of replacing them entirely

https://claude.ai/code/session_019KQTSWuJGhcoeP1WmXkaLZ

…date exports

- PublishedAt: replace spread overrides with deepMerge for proper nested merging
- URLField: use URL API to correctly append draft param when URL has existing query string
- common/index.ts: re-export PublishedAt and URLField from common entry point
- Changeset: reword description to match actual PR scope

https://claude.ai/code/session_019KQTSWuJGhcoeP1WmXkaLZ
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@ainsleyclark ainsleyclark merged commit 171ab54 into claude/add-payload-helper-fields-dfM5C Feb 17, 2026
@ainsleyclark ainsleyclark deleted the claude/deep-merge-published-at-GT9t1 branch February 17, 2026 11:55
ainsleyclark added a commit that referenced this pull request Feb 17, 2026
* feat: Adding URLField and PublishedAt helpers to payload-helper

https://claude.ai/code/session_01NwyDXYNHC8fkcbWpmRpBfg

* style: Moving URLField and PublishedAt to src/fields directory

https://claude.ai/code/session_01NwyDXYNHC8fkcbWpmRpBfg

* chore: add changeset for fields directory move

https://claude.ai/code/session_01NwyDXYNHC8fkcbWpmRpBfg

* fix: guard URLField against undefined generate return value

When generate() returned undefined and draft mode was active, the hook
would produce the string "undefined?draft=true". Now returns undefined
early when generate yields no value.

https://claude.ai/code/session_01NwyDXYNHC8fkcbWpmRpBfg

* fix: use deepMerge in PublishedAt, fix URLField draft query param, update exports (#416)

- PublishedAt: replace spread overrides with deepMerge for proper nested merging
- URLField: use URL API to correctly append draft param when URL has existing query string
- common/index.ts: re-export PublishedAt and URLField from common entry point
- Changeset: reword description to match actual PR scope

https://claude.ai/code/session_019KQTSWuJGhcoeP1WmXkaLZ

Co-authored-by: Claude <noreply@anthropic.com>

* fix: URL stuff

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants