Fix column layout null validation and error display#1090
Open
busbyk wants to merge 2 commits into
Open
Conversation
Add self-healing beforeChange hook that auto-fixes null/invalid layout values to a sensible default matching the current column count. Fix the ColumnLayoutPicker custom component to display validation errors and auto-heal null values in the UI on mount. Fixes #1086 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use @ts-expect-error with partial mock pattern instead of `as` casts, matching the project's lint rules and existing test conventions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Preview deployment: https://fixxcolumn-layout-null.preview.avy-fx.org |
rchlfryn
approved these changes
Jun 5, 2026
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
Pages created during the initial production seed had
nullvalues for their content block layout fields. This caused a validation error on save, and the customColumnLayoutPickercomponent didn't display the error or allow fixing the value.Related Issues
Fixes #1086
Key Changes
src/blocks/Content/hooks/healColumnLayout.ts): AbeforeChangefield hook that auto-fixes null/invalid layout values to a sensible default matching the current column countsrc/components/ColumnLayoutPicker/index.tsx): The custom component now usesshowError/errorMessagefrom Payload'suseFieldhook to display validation errors inlineuseEffectthat detects null values on mount and auto-selects a valid layout option matching the column countHow to test
pnpm test -- __tests__/server/healColumnLayout.server.test.tsScreenshots / Demo video
https://www.loom.com/share/d8d56a158c404736b0a8adea17a15dea
Migration Explanation
No migration needed — hook and UI logic only.
🤖 Generated with Claude Code