Fix empty-state, value display, collapse and class issues in entries - #12
Merged
Merged
Conversation
- Treat only null/undefined/''/[] as empty; 0 and false render (frontend entries and BadgeEntry colors/icons lookup in PHP) - Map snake_case entry types (incl. repeatable_entry) in RepeatableEntry and read nested values with dot notation - RepeatableEntry: track toggles relative to the collapsed default; InfoList sections honour collapsible()/collapsed(); keyboard + aria - Format arrays/objects (joined text / JSON) instead of [object Object] - Normalize snake_case entry props to the camelCase props components declare - Static column-span / grid-column class maps (lib/entries.ts) - Vue: sanitize html() TextEntry output (port of de24c34) Vue and React are changed together to keep parity. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 28 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (23)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Stability fixes for infolist entries and
InfoList. Every frontend change is made in both the Vue (resources/js) and React (resources/react) stacks so they behave the same.Fixes
0andfalseare no longer "empty": entries use a sharedisEmptyState()(null, undefined,'',[]) instead of truthiness. A0/falsestate now renders instead of the placeholder in Badge, Color, Code, Icon and Image entries. Badgecolors/iconslookups work for0/falsestates, both in PHP (BadgeEntry::toLaraviltProps) and in the frontend.repeatable_entrymapping: RepeatableEntry now maps the snake_case entry types the server sends (text_entry,badge_entry, ...), including nestedrepeatable_entry. Before, every nested entry fell back to TextEntry. Nested values are read with dot-notation support (author.name).collapseddefault, so items that arrive later follow the default instead of staying hidden. Collapsible item headers are keyboard accessible (role="button",aria-expanded, Enter/Space). InfoList sections now honourcollapsible()/collapsed(), with the same keyboard and aria support.formatStateValue()joins arrays (TextEntry uses itsseparator, default,) and shows objects as JSON, instead of[object Object]or raw arrays. This applies to TextEntry, BadgeEntry, ColorEntry and KeyValueEntry values. CodeEntry pretty-prints object states. ImageEntry renders one image per URL for array states.normalizeEntryProps(), which also exposes snake_case keys (empty_message,default_image, ...) under the camelCase names the components declare. camelCase keys win when both exist.lib/entries.ts(identical in both stacks) and are no longer template strings. Gridcolumnsnow also accepts 7-12 and responsive objects.html()sanitization: portedsanitizeHtmlfrom de24c34 toresources/js/lib/sanitizeHtml.ts. Vue TextEntry now sanitizeshtml()output beforev-html, like React.Tests
tests/Unit/BadgeEntryFalsyStateTest.php, covering0,'0',false, non-scalar and null states.vendor/bin/pestpasses.npx tsc --noEmit -p tsconfig.laravilt.jsonreports no errors in this package.Behaviour changes
0orfalsenow show the value instead of the placeholder.html()entries lose script-capable markup, as React's already did.collapsible()/collapsed()can now be collapsed, andcollapsed()sections start closed.🤖 Generated with Claude Code