Skip to content

[Bug]: Lazy loaded tabels push query parameter #2306

@christian-forgacs

Description

@christian-forgacs

What happened?

If I add the Attribute #[Lazy] to my data table class after loading my url of current page change to e.g.

customer?tableperPage=10&table-columns-customer[0]=kundennummer&table-columns-customer[1]=name&table-columns-customer[2]=vertreter&table-columns-customer[3]=filiale&table-columns-customer[4]=unterkunden&table-columns-customer[7]=&page-customer=2

At some tables e.g. the query parameter "*perPage" is empty and this bug produce on explicit page reload following exception:

Cannot assign string to property Rappasoft\LaravelLivewireTables\DataTableComponent::$perPage of type ?int

because the url parameter is empty, not null or a int. Here the url:

master_order?table-sorts-masterorder[order_number]=desc&tableperPage=&table-columns-masterorder[0]=auftrnr&table-columns-masterorder[1]=schlagw&table-columns-masterorder[2]=kunde&table-columns-masterorder[3]=auftragsart&table-columns-masterorder[4]=auftrags-kat&table-columns-masterorder[5]=anzahl-positionen&table-columns-masterorder[6]=nettopreis-gesamt&table-columns-masterorder[7]=vertreter&table-columns-masterorder[8]=erstellt-am&table-columns-masterorder[9]=positionen&table-columns-masterorder[10]=

How to reproduce the bug

Add Attribute #[Lazy] from livewire to the data table component.

Note

If I remove the lazy attribute on the class and add it directly to the livewire tag at the page everything works great. But if I load a table in an e.g. modal loaded by livewire (wire-elements/modal) same issue appears.

After I use setQueryStringDisabled its "working" but this is only a workaround... In my case after that only query parameter for sorting will added to the url.

Package Version

3.7.3

PHP Version

8.4

Laravel Version

12.25.0

Alpine Version

3

Theme

Tailwind 3.x

Error Message

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions