Skip to content

Commit 6b69db1

Browse files
committed
Fix for UnitTest failure with new SessionGridFieldStateManager functionality
1 parent 898ef9b commit 6b69db1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Forms/GridField/GridState_Data.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class GridState_Data
1919
*/
2020
protected $data;
2121

22-
protected GridState $state;
22+
protected ?GridState $state;
2323

2424
protected $defaults = [];
2525

26-
public function __construct($data = [], GridState $state = null)
26+
public function __construct($data = [], ?GridState $state = null)
2727
{
2828
$this->data = $data;
2929
$this->state = $state;
@@ -88,7 +88,7 @@ public function getData($name, $default = null)
8888
public function storeData()
8989
{
9090
$stateManager = $this->getStateManager();
91-
if (ClassInfo::hasMethod($stateManager, 'storeState')) {
91+
if (ClassInfo::hasMethod($stateManager, 'storeState') && $this->state) {
9292
$stateManager->storeState($this->state->getGridField(), $this->state->Value());
9393
}
9494
}

0 commit comments

Comments
 (0)