Skip to content

Commit e9c2db3

Browse files
committed
fix: default state of form field
1 parent 654aee4 commit e9c2db3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Forms/Components/Tree.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ protected function setUp(): void
3838
parent::setUp();
3939

4040
$this->default([]);
41+
42+
$this->afterStateHydrated(function (Tree $component, $state) {
43+
if (! is_array($state)) {
44+
$state = [];
45+
}
46+
47+
$component->state($state);
48+
});
4149
}
4250

4351
public function getNodes(): array

0 commit comments

Comments
 (0)