Skip to content

Commit

Permalink
Fix for UnitTest failure with new SessionGridFieldStateManager functi…
Browse files Browse the repository at this point in the history
…onality
  • Loading branch information
forsdahl committed Dec 20, 2024
1 parent 666d732 commit 7a52182
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Forms/GridField/GridState_Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class GridState_Data
*/
protected $data;

protected GridState $state;
protected ?GridState $state;

protected $defaults = [];

public function __construct($data = [], GridState $state = null)
public function __construct($data = [], ?GridState $state = null)
{
$this->data = $data;
$this->state = $state;
Expand Down Expand Up @@ -88,7 +88,7 @@ public function getData($name, $default = null)
public function storeData()
{
$stateManager = $this->getStateManager();
if (ClassInfo::hasMethod($stateManager, 'storeState')) {
if (ClassInfo::hasMethod($stateManager, 'storeState') && $this->state) {
$stateManager->storeState($this->state->getGridField(), $this->state->Value());
}
}
Expand Down

0 comments on commit 7a52182

Please sign in to comment.