-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Package
filament/filament
Package Version
v4.5.2
Laravel Version
v12.46.0
Livewire Version
v3.7.3
PHP Version
8.4.16
Problem description
There appears to be an issue with how statePath is resolved when using deeply nested Layout Components (e.g. Section, Grid, Group, etc.) inside Infolists.
When multiple layout components are nested and each defines its own statePath, the effective state resolution does not correctly compose all parent paths. In practice, only part of the parent hierarchy seems to be applied, even though the final component reports a fully qualified path via getStatePath().
This behavior is not specific to constantState, which is only used here to simplify reproduction, and not specific to Section. The same issue occurs with other layout components and across infolists in general.
The problem becomes especially visible in dynamic schemas (e.g. layouts generated from database definitions), where layouts may be nested arbitrarily.
Expected behavior
- All nested Layout Components should correctly and consistently compose their
statePathvalues. - The resolved state path used internally by the infolist should match the path returned by
getStatePath(). - Deep nesting should not cause parent
statePathsegments to be dropped or collapsed. - Behavior should be consistent regardless of whether the schema is static or dynamically generated.
constantStateshould not affect state resolution logic beyond providing initial data.
Steps to reproduce
-
Create an infolist schema with a nested object state (using
constantStateonly to provide test data):return $schema->constantState([ 'page' => [ 'block' => [ 'configuration' => [ 'content' => 'Block configuration content', ], ], ], ])->components([ Section::make('Page') ->statePath('page') ->schema([ Section::make('Block') ->statePath('block') ->schema([ KeyValueEntry::make('configuration'), ]), ]), ]);
-
Observe that:
getStatePath()on the final entry returns the fully composed path (page.block.configuration).getConstantStatePath()on the final entry only returns the immediate parent layout path (block.configuration), instead of the full absolute path.- As a result, the value is not consistently resolved from the infolist state.
Reproduction repository (issue will be closed if this is not valid)
https://github.com/alancolant/filament-nested-infolist-issue
Relevant log output
Metadata
Metadata
Assignees
Labels
Type
Projects
Status