Fix for UnitTest failure with new SessionGridFieldStateManager functionality

This commit is contained in:
Niklas Forsdahl 2024-06-27 16:06:32 +03:00
parent 898ef9ba31
commit 6b69db1e3b

View File

@ -19,11 +19,11 @@ class GridState_Data
*/ */
protected $data; protected $data;
protected GridState $state; protected ?GridState $state;
protected $defaults = []; protected $defaults = [];
public function __construct($data = [], GridState $state = null) public function __construct($data = [], ?GridState $state = null)
{ {
$this->data = $data; $this->data = $data;
$this->state = $state; $this->state = $state;
@ -88,7 +88,7 @@ class GridState_Data
public function storeData() public function storeData()
{ {
$stateManager = $this->getStateManager(); $stateManager = $this->getStateManager();
if (ClassInfo::hasMethod($stateManager, 'storeState')) { if (ClassInfo::hasMethod($stateManager, 'storeState') && $this->state) {
$stateManager->storeState($this->state->getGridField(), $this->state->Value()); $stateManager->storeState($this->state->getGridField(), $this->state->Value());
} }
} }