Skip to content

Commit 44cb4d6

Browse files
committed
wip
1 parent d41b39b commit 44cb4d6

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Fields/Field.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ abstract class Field implements Arrayable, JsonSerializable
105105
*/
106106
protected bool $withOldValue = true;
107107

108-
/**
109-
* Indicates if the field has been hydrated.
110-
*/
111-
protected bool $hydrated = false;
112-
113108
/**
114109
* Indicates if the field is sortable.
115110
*/
@@ -471,9 +466,11 @@ public function value(?Closure $callback = null): static
471466
*/
472467
public function resolveValue(Request $request, Model $model): mixed
473468
{
474-
if (! $this->hydrated && $this->withOldValue && $request->session()->hasOldInput($this->getRequestKey())) {
475-
$this->resolveHydrate($request, $model, $this->getOldValue($request));
476-
}
469+
once(function () use ($request, $model): void {
470+
if ($this->withOldValue && $request->session()->hasOldInput($this->getRequestKey())) {
471+
$this->resolveHydrate($request, $model, $this->getOldValue($request));
472+
}
473+
});
477474

478475
$value = $this->getValue($model);
479476

@@ -615,8 +612,6 @@ public function resolveHydrate(Request $request, Model $model, mixed $value): vo
615612
}
616613

617614
call_user_func_array($this->hydrateResolver, [$request, $model, $value]);
618-
619-
$this->hydrated = true;
620615
}
621616

622617
/**

0 commit comments

Comments
 (0)