Queued exports fail when using ->fromTable() due to closures being unserializable #235
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing information
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pxlrbt/filament-excel#235
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When trying to run an export with both ->queue() and ->fromTable(), the job fails with:
Serialization of 'Closure' is not allowedThis happens because the table definitions (formatStateUsing, visible, etc.) rely on closures, which cannot be serialized for the queue.
Steps to reproduce
Expected behavior
It should be possible to combine ->fromTable() with ->queue() so that large exports can be processed in the background while still respecting the table configuration (columns, filters, sorting).
Actual behavior
Question
Is there any planned support or recommended workaround for making ->fromTable()->queue() compatible (e.g., removing closures automatically, or allowing serialization of table state)?
Thanks for reporting. Closures are either removed or serialized already, but when there is a new method that accepts a Closure, I need to track that down and remove it from serialization. I can have a look at it in the coming weeks.
Are there any updates on this issue?
No, sorry. Right now I am too busy with client projects. Hope to find some time the next wekks.
There seems to be a partial workaround here that you can use ->useTableQuery with ->queue; however the formatStateUsing method on the Column instances seems to no longer inject $record so if you need a custom value, build it in the query to pass through that way. Interestingly $state is being injected ok.
I also have a report that only overrides the datasheet as needed to hand roll the sheet layout using fromArray in the export class. If I switch this to using queue I just get an empty sheet 🤔
for reference Im having this issue on PHP 8.3, Filament 3.3, Filament Excel 2.5
Still facing the same issue
@kayedspace That's obvious, since there was no fix.
I have the same issue after upgrading my project from filament v3 to v4.
Can everybody please try v3.2.1. @kayedspace digged into this and submitted a PR.