livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
341 stars 19 forks source link

Issue with Bus facade/batches in computed property #47

Closed undjike closed 1 year ago

undjike commented 1 year ago

Volt Version

1.3.0

Laravel Version

10.10.0

PHP Version

8.2.3

Database Driver & Version

MySQL 8.0.28

Description

I don't know what's wrong but this code generates an error.

$batch = computed(fn () => Bus::findBatch($this->batchId));

// Even when I use a constant as batch ID like...
$batch = computed(fn () => Bus::findBatch('xxxxxxxx'));

image image

Even if I create a variable to assign this expression on mount, same error. But once I put something other than this expression, everything works.

I wonder whether it's caused by the Bus facade...

Here is how the view code looks like image

Steps To Reproduce

In a Volt component (here anonymous), create a computed property retrieving a batch instance from the database.

undjike commented 1 year ago

Even this syntax causes the same issue.

image

Here, the batchId is coming from Folio.

undjike commented 1 year ago

More and more strange.

I even created a classic Livewire full page component. But it seems like, with Volt installed, the problem stays the same.

image

undjike commented 1 year ago

I think I found out where this issue is coming from.

It's caused by these lines of code :

  1. Within \Illuminate\Bus\Dispatcher::findBatch

image

  1. Within \Illuminate\Bus\Batchable::batch

image

Any idea of how we can tacle it?

nunomaduro commented 1 year ago

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!