Skip to content

Fix empty-state, value display, collapse and class issues in entries - #12

Merged
fadymondy merged 1 commit into
masterfrom
fix/stability
Sep 15, 2026
Merged

fadymondy merged 1 commit into
masterfrom
fix/stability

Conversation

@fadymondy

Copy link
Copy Markdown
Contributor

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

  • 0 and false are no longer "empty": entries use a shared isEmptyState() (null, undefined, '', []) instead of truthiness. A 0/false state now renders instead of the placeholder in Badge, Color, Code, Icon and Image entries. Badge colors/icons lookups work for 0/false states, both in PHP (BadgeEntry::toLaraviltProps) and in the frontend.
  • repeatable_entry mapping: RepeatableEntry now maps the snake_case entry types the server sends (text_entry, badge_entry, ...), including nested repeatable_entry. Before, every nested entry fell back to TextEntry. Nested values are read with dot-notation support (author.name).
  • Collapsed state: RepeatableEntry now tracks the items the user toggled away from the collapsed default, 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 honour collapsible()/collapsed(), with the same keyboard and aria support.
  • Object values: a shared formatStateValue() joins arrays (TextEntry uses its separator, 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.
  • snake_case vs camelCase props: InfoList and RepeatableEntry pass entry props through normalizeEntryProps(), which also exposes snake_case keys (empty_message, default_image, ...) under the camelCase names the components declare. camelCase keys win when both exist.
  • Column spans kept by Tailwind: column-span and grid-column classes come from static maps in a shared lib/entries.ts (identical in both stacks) and are no longer template strings. Grid columns now also accepts 7-12 and responsive objects.
  • Vue html() sanitization: ported sanitizeHtml from de24c34 to resources/js/lib/sanitizeHtml.ts. Vue TextEntry now sanitizes html() output before v-html, like React.

Tests

  • Added tests/Unit/BadgeEntryFalsyStateTest.php, covering 0, '0', false, non-scalar and null states.
  • vendor/bin/pest passes. npx tsc --noEmit -p tsconfig.laravilt.json reports no errors in this package.

Behaviour changes

  • Entries whose state is 0 or false now show the value instead of the placeholder.
  • Array and object states show as joined text or JSON.
  • Vue html() entries lose script-capable markup, as React's already did.
  • InfoList sections marked collapsible()/collapsed() can now be collapsed, and collapsed() sections start closed.

🤖 Generated with Claude Code

- 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>
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 65347620-c2d7-48e6-9ae6-47effe7d5281

📥 Commits

Reviewing files that changed from the base of the PR and between 49881f7 and 6f2faef.

📒 Files selected for processing (23)
  • resources/js/components/InfoList.vue
  • resources/js/components/entries/BadgeEntry.vue
  • resources/js/components/entries/CodeEntry.vue
  • resources/js/components/entries/ColorEntry.vue
  • resources/js/components/entries/IconEntry.vue
  • resources/js/components/entries/ImageEntry.vue
  • resources/js/components/entries/KeyValueEntry.vue
  • resources/js/components/entries/RepeatableEntry.vue
  • resources/js/components/entries/TextEntry.vue
  • resources/js/lib/entries.ts
  • resources/js/lib/sanitizeHtml.ts
  • resources/react/components/InfoList.tsx
  • resources/react/components/entries/BadgeEntry.tsx
  • resources/react/components/entries/CodeEntry.tsx
  • resources/react/components/entries/ColorEntry.tsx
  • resources/react/components/entries/IconEntry.tsx
  • resources/react/components/entries/ImageEntry.tsx
  • resources/react/components/entries/KeyValueEntry.tsx
  • resources/react/components/entries/RepeatableEntry.tsx
  • resources/react/components/entries/TextEntry.tsx
  • resources/react/lib/entries.ts
  • src/Entries/BadgeEntry.php
  • tests/Unit/BadgeEntryFalsyStateTest.php

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fadymondy
fadymondy merged commit 892aa5d into master Sep 15, 2026
5 checks passed
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.

1 participant