Héctor Q. Torres
Héctor Q. Torres
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
I discovered the problem. Actually, I had started the project using the PHPUnit package (since I was used to using it for API tests). However, after creating a new project from scratch and choosing Pest, I noticed that a file is created: /tests/Pest.php:
<?php

pest()->extend(Tests\TestCase::class)
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
->in('Feature');

expect()->extend('toBeOne', function () {
return $this->toBe(1);
});

function something()
{
// ..
}
<?php

pest()->extend(Tests\TestCase::class)
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
->in('Feature');

expect()->extend('toBeOne', function () {
return $this->toBe(1);
});

function something()
{
// ..
}
This way, everything worked correctly. Since my scenario involves multi-tenancy, I also needed to add the following setup in TestCase:
Filament::setTenant(MyEntityTenant::where(...)->first())
Filament::setTenant(MyEntityTenant::where(...)->first())
Thanks for the help again!
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
I think this will be better, thank you for your time. If I figure out the problem, I’ll come back here with the solution.
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
No description
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
Yes, I am
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
Yes, i am
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
But I have an env.testing variable set, pointing to a test database.
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
No description
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
My bad 🤣 Ok, return 'false'
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
No description
21 replies
FFilament
Created by Héctor Q. Torres on 3/27/2025 in #❓┊help
Target class [livewire] does not exist.
No description
21 replies
FFilament
Created by Héctor Q. Torres on 3/24/2025 in #❓┊help
How to Disable Table Polling in a Header Action on a Resource List Page?
class ListImports extends ListRecords implements HasForms
{
use InteractsWithForms, ManageLayouts;

protected static string $resource = ImportResource::class;

protected static string $view = 'filament.app.resources.import-resource.pages.list-imports';

protected $listeners = [
'open-modal' => 'disablePolling',
'close-modal' => 'enablePolling',
];

public ?array $data = [];

public $pollingEnabled = true;

public $isHeaderActionOpen = false;

public function enablePolling($id): void
{
if ($this->isHeaderActionOpen) {
$this->isHeaderActionOpen = false;
return;
}

$this->pollingEnabled = true;
}

public function disablePolling($id): void
{
if (!str_contains($id, '-form-component-action')) {
$this->isHeaderActionOpen = true;
}

$this->pollingEnabled = false;
}

...
}
class ListImports extends ListRecords implements HasForms
{
use InteractsWithForms, ManageLayouts;

protected static string $resource = ImportResource::class;

protected static string $view = 'filament.app.resources.import-resource.pages.list-imports';

protected $listeners = [
'open-modal' => 'disablePolling',
'close-modal' => 'enablePolling',
];

public ?array $data = [];

public $pollingEnabled = true;

public $isHeaderActionOpen = false;

public function enablePolling($id): void
{
if ($this->isHeaderActionOpen) {
$this->isHeaderActionOpen = false;
return;
}

$this->pollingEnabled = true;
}

public function disablePolling($id): void
{
if (!str_contains($id, '-form-component-action')) {
$this->isHeaderActionOpen = true;
}

$this->pollingEnabled = false;
}

...
}
7 replies
FFilament
Created by Héctor Q. Torres on 3/24/2025 in #❓┊help
How to Disable Table Polling in a Header Action on a Resource List Page?
My reason for using mountUsing was to stop the polling after the action was mounted.
But I am indeed using an ->action().
I managed to make it work in a very improvised way.
The issue is that I have a header action that opens a form, which in turn has a creation option.
Due to polling, I was having problems when trying to submit the open modals because the actions were being disabled between polling intervals.
Another issue was that when filling in some file upload fields, the files would disappear if a polling event occurred while they were still being uploaded.
I searched in various places before coming here and checked this article:
Understanding Laravel Filament V3: Resolving Disabled Action Components on ViewResource with Polling,
but I couldn't find a way to stop the polling when opening the modal and resume it when closing (whether the action was submitted or not).
The way I managed to solve it was by combining your suggestion with the following code:
(The code is in the next message)
(The code is in the next message)
It was improvised, but I managed to enable and disable polling only when the first modal in the chain is opened or closed (regardless of whether the action was submitted or not). If you have a better suggestion, I'd love to hear it!
7 replies
FFilament
Created by Héctor Q. Torres on 3/24/2025 in #❓┊help
How to Disable Table Polling in a Header Action on a Resource List Page?
OK, I made the change, but it still doesn't work.
I updated my table configuration as follows:
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->poll(fn ($livewire) => $livewire->pollingEnabled ? '1s' : null) // 1s for testing
->columns([ ... ])
...
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->poll(fn ($livewire) => $livewire->pollingEnabled ? '1s' : null) // 1s for testing
->columns([ ... ])
...
}
And in my header action:
public $pollingEnabled = true;

protected function getHeaderActions(): array
{
return [
Action::make('create')
->mountUsing(fn () => $this->pollingEnabled = null) // Trying to disable polling
...
];
}
public $pollingEnabled = true;

protected function getHeaderActions(): array
{
return [
Action::make('create')
->mountUsing(fn () => $this->pollingEnabled = null) // Trying to disable polling
...
];
}

However, the polling is still running. Any idea why this isn't working?
7 replies