diff --git a/packages/support/src/Concerns/HasCellState.php b/packages/support/src/Concerns/HasCellState.php index f9212cd347..3460d7baf8 100644 --- a/packages/support/src/Concerns/HasCellState.php +++ b/packages/support/src/Concerns/HasCellState.php @@ -82,8 +82,9 @@ trait HasCellState return null; } - if (array_key_exists($record->getKey(), $this->cachedState)) { - return $this->cachedState[$record->getKey()]; + $recordKey = (string) $record->getKey(); + if (array_key_exists($recordKey, $this->cachedState)) { + return $this->cachedState[$recordKey]; } $state = ($this->getStateUsing !== null) ? @@ -101,7 +102,7 @@ trait HasCellState $state = $this->getDefaultState(); } - return $this->cachedState[$record->getKey()] = $state; + return $this->cachedState[$recordKey] = $state; } public function getStateFromRecord(): mixed