Skip to content

Commit

Permalink
Fix tests & phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Apr 23, 2024
1 parent b9b13cd commit dfe9707
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 42 deletions.
11 changes: 6 additions & 5 deletions packages/schema/src/Concerns/HasStateBindingModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ trait HasStateBindingModifiers

protected bool $isLiveOnBlur = false;

/** @var array<string> */
protected array $livePartials = [];

/**
Expand All @@ -39,12 +40,9 @@ public function reactive(): static
return $this;
}

/**
* @param array<string> $partials
*/
public function lazy(array $partials = []): static
public function lazy(): static
{
$this->live(onBlur: true, partiallyRender: $partials);
$this->live(onBlur: true);

return $this;
}
Expand Down Expand Up @@ -168,6 +166,9 @@ public function isLazy(): bool
return $this->isLiveOnBlur();
}

/**
* @return array<string>
*/
public function getLivePartials(): array
{
return $this->livePartials;
Expand Down
21 changes: 0 additions & 21 deletions packages/support/src/Overrides/OverrideHandleComponents.php

This file was deleted.

23 changes: 9 additions & 14 deletions packages/support/src/Partials/SupportPartials.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

class SupportPartials extends ComponentHook
{
public function hydrate(): void
{
if (! app()->runningUnitTests()) {
$this->storeSet('skipRender', fn (): bool => $this->shouldSkipRender());
}
}

public function call(): Closure
{
$this->storeSet('callsCount', ($this->storeGet('callsCount') ?? 0) + 1);
Expand Down Expand Up @@ -62,13 +69,13 @@ public function shouldSkipRender(): bool

public function shouldRender(): bool
{
$effects = ($this->storeGet('callsCount') ?? 0) + ($this->storeGet('updatesCount') ?? 0);
$effects = intval($this->storeGet('callsCount') ?? 0) + intval($this->storeGet('updatesCount') ?? 0);

if (! $effects) {
return true;
}

$renders = count($this->storeGet('partials') ?? []) + ($this->storeGet('partialSkipsCount') ?? 0);
$renders = count($this->storeGet('partials') ?? []) + intval($this->storeGet('partialSkipsCount') ?? 0);

if (! $renders) {
return true;
Expand Down Expand Up @@ -113,18 +120,6 @@ public function shouldRenderMountedActionsOnly(bool $whenActionMounted = true):
return $this->component->getOriginallyMountedActionIndex() !== $mountedActionIndex;
}

protected function renderAndQueuePartials(Closure $getPartialsUsing): void
{
app(ExtendBlade::class)->startLivewireRendering($this->component);

$this->partials = [
...$this->partials,
...$getPartialsUsing(),
];

app(ExtendBlade::class)->endLivewireRendering();
}

public function dehydrate(ComponentContext $context): void
{
$partials = [];
Expand Down
2 changes: 0 additions & 2 deletions packages/support/src/SupportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ class_exists(RequestReceived::class) && Event::listen(RequestReceived::class, fn
->withMaxInputLength(500000),
),
);

$this->app->bind(HandleComponents::class, OverrideHandleComponents::class);
}

public function packageBooted(): void
Expand Down

0 comments on commit dfe9707

Please sign in to comment.