Closed mendozal closed 1 month ago
@mendozal I can't reproduce this bug please create a public repo with the minimum amount of code that reproduces this bug send the link here and mention me so I reopen this issue.
Hi @ariaieboy
This is the repository https://github.com/mendozal/filament-money-test
username: admin@test.com password: password
Please enter an amount that can be formatted in the Item Amount field (starting 1,000)
Once formatted, the output of the php artisan serve command should show infinite livewire/update calls. And if you remove the currencyMask function from the second repeater component, it doesn't do it.
Hi @ariaieboy
I noticed that this new release fixed the issue where infinite livewire/update calls were made.
But now I noticed that if the live() field (the one that causes the afterStateUpdated) has a currencyMask, it's basically rendered as not being live() and doesn't trigger any livewire/update at all.
I updated the github repository if you'd like to test. The steps are to enable and disable the currencyMask on the "itemAmount" field and see the effects.
Hi @ariaieboy
I noticed that this new release fixed the issue where infinite livewire/update calls were made.
But now I noticed that if the live() field (the one that causes the afterStateUpdated) has a currencyMask, it's basically rendered as not being live() and doesn't trigger any livewire/update at all.
I updated the github repository if you'd like to test. The steps are to enable and disable the currencyMask on the "itemAmount" field and see the effects.
test https://github.com/ariaieboy/filament-currency/releases/tag/1.8.3
Hi @ariaieboy I noticed that this new release fixed the issue where infinite livewire/update calls were made. But now I noticed that if the live() field (the one that causes the afterStateUpdated) has a currencyMask, it's basically rendered as not being live() and doesn't trigger any livewire/update at all. I updated the github repository if you'd like to test. The steps are to enable and disable the currencyMask on the "itemAmount" field and see the effects.
test https://github.com/ariaieboy/filament-currency/releases/tag/1.8.3
Now the last issue is fixed, but the infinite livewire/update issue is back.
@mendozal test 1.8.4
@mendozal test 1.8.4
Working fine now. Thanks!
What happened?
I have a repeater that runs a function on the repeater's afterStateUpdate().
This function calculates totals and also updates a field inside the repeater's line that's called "total". This total field has a currencyMask().
The issue is that updating the "total" field from the afterStateUpdate() callback triggers an infinite series of posts to /livewire/update. This doesn't happen when I remove the currencyMask() function.
It seems as if updating the total field triggers a currency format, and this in turn triggers the afterStateUpdate again and so on.
How to reproduce the bug
Create a repeater maybe liket his:
I created this function to test. It automatically sets the value to 5000 which trigger the infinite loop thing.
Please notice that if I set a value below 1000, for example 999 or 50, it doesn't seem to trigger this behavior. Since it doesn't seem to need to format the string.
Check the output of php artisan serve:
2024-08-08 15:59:44 /css/filament/support/support.css?v=3.2.97.0 ...................................................................................................... ~ 0.08ms 2024-08-08 15:59:44 /css/filament/filament/app.css?v=3.2.97.0 ......................................................................................................... ~ 0.04ms 2024-08-08 15:59:44 /js/filament/notifications/notifications.js?v=3.2.97.0 ............................................................................................ ~ 0.02ms 2024-08-08 15:59:44 /js/filament/support/async-alpine.js?v=3.2.97.0 ................................................................................................... ~ 0.02ms 2024-08-08 15:59:44 /js/filament/support/support.js?v=3.2.97.0 ........................................................................................................ ~ 0.02ms 2024-08-08 15:59:44 /js/filament/filament/echo.js?v=3.2.97.0 .......................................................................................................... ~ 0.02ms 2024-08-08 15:59:44 /js/filament/filament/app.js?v=3.2.97.0 ........................................................................................................... ~ 0.02ms 2024-08-08 15:59:44 /js/filament/forms/components/select.js?v=3.2.97.0 ................................................................................................ ~ 0.02ms 2024-08-08 15:59:44 /favicon.ico ...................................................................................................................................... ~ 0.04ms 2024-08-08 15:59:47 /livewire/update .................................................................................................................................. ~ 0.18ms 2024-08-08 15:59:47 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:47 /livewire/update .................................................................................................................................. ~ 0.02ms 2024-08-08 15:59:47 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:47 /livewire/update .................................................................................................................................. ~ 0.07ms 2024-08-08 15:59:48 /livewire/update ................................................................................................................................ ~ 500.27ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.02ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.02ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.08ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.06ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.05ms 2024-08-08 15:59:48 /livewire/update .................................................................................................................................. ~ 0.05ms 2024-08-08 15:59:49 /livewire/update ................................................................................................................................ ~ 500.39ms 2024-08-08 15:59:49 /livewire/update .................................................................................................................................. ~ 0.07ms 2024-08-08 15:59:49 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:49 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:49 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:49 /livewire/update .................................................................................................................................. ~ 0.04ms 2024-08-08 15:59:49 /livewire/update .................................................................................................................................. ~ 0.04ms
Package Version
1.8.1
PHP Version
8.3.10
Laravel Version
11.20.0
Which operating systems does with happen with?
Linux
Notes
No response