[6.x] Fix grid min_rows breaking CP navigation - #15033
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <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.
This pull request fixes an issue where a grid field using
min_rowscould break Control Panel navigation until a hard refresh.This was happening because
preProcesspads empty grids tomin_rowsusing rows with freshly generated_ids, but in two places the meta was built from a different value than the one being returned, so the padded rows had no entry inmeta.existing:Grid::preloadbuilt thenewmeta without passing along the default row values, so adding a new row containing a nested grid withmin_rowsproduced rows without meta. (Replicator, Bard and Group already pass the defaults along.)Nested fieldtypes then received
undefinedmeta, leaving behind a broken component tree whose unmount throws theCannot destructure property...error seen in the issue, breaking Inertia navigation until a hard refresh.This PR fixes it by building the
newmeta from the default row values, and by setting the preprocessed value on the field before building the meta in theMetaController.Fixes #14929