@sarfaraz1212 Define “slow”.
Jul 16, 2024
17
Level 1
Inertia React app is slow
I am building a basic project which is not at all complex with React and laravel using inertia but my pages where there is something related to query are loading very slow, even the log/signup provided by breeze is a bit slow.
can anyone suggest me how can i make my app faster?
public function index()
{
$query = Task::query();
$sortField = request("sort_field","created_at");
$sortDirection = request("sort_direction","asc");
if(request('name'))
{
$query->where("name","like","%".request("name")."%");
}
if(request('status'))
{
$query->where("status","like","%".request("status")."%");
}
$tasks = $query->orderBy($sortField,$sortDirection)->paginate(10)->onEachSide(1);
return inertia("Task/index",
[
"tasks" => TaskResource::collection($tasks),
"queryParams" => request()->query() ?: null,
]);
}
this is my page it is rendering like 50-60 records.
Please or to participate in this conversation.