New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript error occurs after an action that displays a modal is run and the modal closes. #3665
Comments
Hey @jojostx! We're sorry to hear that you've hit this issue. 💛 However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue? We need a public Git repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly. |
Thank you for providing reproduction steps! Reopening the issue now. |
@jojostx Seems like if you edit a record this occurs too. This is happening on a project I am working on as well, in a similar case where a popup modal is shown on the RelationsManager. Thanks |
@byjujohn I suspect it has to do with the way the modal is closed after an action is dispatched, |
This looks like a scoping issue or a bug in Alpine. Apparently, $wire is not defined inside $watch as it is not declared on This fixes the issue and I'm happy to do a PR for this, but something doesn't feel right about it. Any thoughts @zepfietje @danharrin this.wire = $wire.__instance;
$watch('isOpen', () => {
if (isOpen) {
return
}
this.wire.mountedTableAction = null
}) |
I've had a similar issue with However, for this case that wouldn't work. Your fix may be kind of a dirty fix, but if it works... Not sure if this issue got introduced just recently and is a regression, or really a bug with Alpine? |
This has to be something in Alpine. $wire is available outside of $watch. |
@danharrin mentioned he had a potential fix ready locally. Let's see what he'll PR. |
@awcodes I submitted PR #3810 which completely removes that code. It was originally added to allow people to customize their action forms based on Create or Edit, but it never worked properly as some actions use |
But potentially it is a breaking change if we remove it... |
So, we're good on this? |
Is it a Livewire bug that |
I'm sure this worked previously |
Does |
but it does have to bet $wire.__instance, other wise it throughs a 500. |
But does it make an AJAX request with your fix? |
I'm seeing the same AJAX requests with or without the fix |
weird... so the console error is there for nothing? |
Looks like it. LOL Maybe it's some weird race condition. |
Had the same with notifications. Worked fine despite the error. |
And did you fix that? |
I first solved that case by passing |
Alright. I am going to update my PR to @awcodes's suggestion |
Seems a good solution for now. |
Turns out that setting I swapped it out for |
@danharrin Any news regarding this issue? I see it still reproduced and looks like fix was reverted. Also found that if modal have repeater it is not working, collapsing/expanding, sorting of repeater items |
Hey, the fix was not reverted, we just didn't need any of the code that handled closing modals any more. I can't reproduce the problem myself any more? Please submit a new issue with a reproduction repository. |
Ok, thanks. I think similar issue already created here #3906 |
Package
filament/filament
Package Version
^2.13
Laravel Version
v9.11.0
Livewire Version
v2.5
PHP Version
PHP 8.0
Problem description
After an action that requires confirmation or displays a modal is run, and the modal closes, a javascript error occurs:
Alpine: Cannot reference "$wire" outside a Livewire component.
Uncaught TypeError: wireEl is null
Expected behavior
The action completes and the modal closes without a Javascript error occurring
Steps to reproduce
Reproduction repository
https://github.com/jojostx/filament-demo
Relevant log output
No response
The text was updated successfully, but these errors were encountered: