Weird random issues with Filament Table using Sushi on swapping users.

Hello, I have a table that consumes from an API and displays data in a table using sushi. It works great but. I have noticed that if I -> login with a user A ---> it shows data correctly ( using user A params, Im tracking petitions in API server to check params of petitions)-->logoff -> in the same page without reloading login with user B (using user B params) NOW sometimes the table still displays A data (even if server recived B params correctly and returned B data). Any ideas of what can be causing that. Thanks in advance. This is my table
return $table
->paginated([100, 200, 300, 'all'])
->query(InvoiceModel::query())
->columns([
TextColumn::make('invoice'),
TextColumn::make('total_amount')->money(),
//..
])
return $table
->paginated([100, 200, 300, 'all'])
->query(InvoiceModel::query())
->columns([
TextColumn::make('invoice'),
TextColumn::make('total_amount')->money(),
//..
])
InvoiceModel has the logic for getting the data.
class InvoiceModel extends Model
{
use Sushi;

public $sushiInsertChunkSize = 50;

protected function sushiShouldCache(): bool
{
return true;
}
public function getRows()
{
$params = UsersModel::getFilterBalance();
return $this->getInvoices($params);
}
public function getInvoices($params)
{
return app(RestClientInterface::class)->onSuccess(function (
ClientResponse $response,
) {
$dataResponse = $response->getContent();
$data = $dataResponse["data"];
$result = [];
foreach ($data['transactions'] ?? [] as $transaction) {
$item['invoice'] = $transaction['inv'];
$item['total_amount'] = $transaction['sal'];
//..
$result[] = $item;
}
return $result;
})->onFailures(function (ClientResponse $response) {

})->bearer(request()->session()->get("accessToken"))->invoicesbalance->getInvoices($params);

}
}
class InvoiceModel extends Model
{
use Sushi;

public $sushiInsertChunkSize = 50;

protected function sushiShouldCache(): bool
{
return true;
}
public function getRows()
{
$params = UsersModel::getFilterBalance();
return $this->getInvoices($params);
}
public function getInvoices($params)
{
return app(RestClientInterface::class)->onSuccess(function (
ClientResponse $response,
) {
$dataResponse = $response->getContent();
$data = $dataResponse["data"];
$result = [];
foreach ($data['transactions'] ?? [] as $transaction) {
$item['invoice'] = $transaction['inv'];
$item['total_amount'] = $transaction['sal'];
//..
$result[] = $item;
}
return $result;
})->onFailures(function (ClientResponse $response) {

})->bearer(request()->session()->get("accessToken"))->invoicesbalance->getInvoices($params);

}
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server