1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00

Fixes for circular referece and re-rendering

This commit is contained in:
Benjamin Beganović 2024-02-16 17:42:26 +01:00
parent 0d2087dfc2
commit 5d9da26970

View File

@ -52,12 +52,16 @@ class Purchase extends Component
#[On('purchase.context')] #[On('purchase.context')]
public function handleContext(string $property, $value): self public function handleContext(string $property, $value): self
{ {
$clone = $this->context;
data_set($this->context, $property, $value); data_set($this->context, $property, $value);
// The following may not be needed, as we can pass arround $context. // The following may not be needed, as we can pass arround $context.
// cache()->set($this->hash, $this->context); // cache()->set($this->hash, $this->context);
$this->id = Str::uuid(); if ($clone !== $this->context) {
$this->id = Str::uuid();
}
return $this; return $this;
} }
@ -86,6 +90,18 @@ class Purchase extends Component
return $this->steps[$this->step]; return $this->steps[$this->step];
} }
#[Computed()]
public function componentUniqueId(): string
{
return "purchase-{$this->id}";
}
#[Computed()]
public function summaryUniqueId(): string
{
return "summary-{$this->id}";
}
public function mount() public function mount()
{ {
$this->id = Str::uuid(); $this->id = Str::uuid();