ariaieboy / filament-currency

Enhanced Currency Related stuff for Filament
MIT License
49 stars 8 forks source link

[Bug]: #27

Closed nielsvh2103 closed 5 months ago

nielsvh2103 commented 5 months ago

What happened?

Hi again :')

First of, great package , we really needed this.

In repeaters there is a bug when you delete the row, because the dom state is updated quite a few times for the mask, it will teleport back into the dom.

How to reproduce the bug

Here is a preview:

https://github.com/ariaieboy/filament-currency/assets/60341437/ee545dd4-5987-4586-9500-e5c1fb5b9e95

Screenshot 2024-05-30 at 14 19 20

The fix for this is checking if input is still available.

        updateMasked(){
        console.log(\$data, \$data.input);
            if(typeof Number(this.input) === 'number' && \$data.input){
                this.masked = this.input?.toString().replaceAll('.','$decimalSeparator');
                \$el.dispatchEvent(new Event('input'));
            }
        },

Package Version

1.7.2

PHP Version

8.3.7

Laravel Version

11.9.0

Which operating systems does with happen with?

No response

Notes

I'm gonna make a pull request real quick aswell.

ariaieboy commented 5 months ago

@nielsvh2103 can you test version 1.7.4 and confirm that this bug is not happening?

nielsvh2103 commented 5 months ago

Ill test it right now @ariaieboy

nielsvh2103 commented 5 months ago

Seems to still work due to 1.7.5 by checking if input is not undefined, (/$data && $data.input) was probably redundant as it checks if the field is undefined first. Weird because we also use afterStateUpdated and $set and it worked fine, probably another scenario

But it still works in 1.7.5 regarding this issue :)