-
Notifications
You must be signed in to change notification settings - Fork 18
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
Deleting a resource from the edit page with the UsesResourceLock trait results in an error before redirecting #39
Comments
Hi, thank you for reporting. Could you please share the entire error page of your screenshot with the share button on the top right so I can inspect it? |
Here you go: https://flareapp.io/share/NPLojdgm I don't think the error will be of much help since it does not crash on your code specifically, the problem is that when you delete a model the $record ceases to exist, so maybe in the trait you need to check that the $record is initialized before attempting to access it |
Looking at the errors, it fails when the |
@Jehizkia yes, but once I remove the HasLocks trait it works fine, the HasLocks trait uses the $record variable, the problem is that it doesn't check that that variable is always existant and when you delete a record there's a split second where the Livewire component of the EditRecord is reloaded, and then attempts to load the $record called in your trait but that record does not exist anymore. Maybe could be worth checking that the $record is initialized before attempting to access it in the trait. I can do a PR later and see if I can fix it. Thank you |
@adriaardila Ah, I see what you mean. Yeah, if you could whip something up, I’ll give it a look.👌 |
When attempting to delete a resource from the edit page, it throws an error before redirecting the user to the index page / table.
It happens on all edit pages (for example EditContact) that have the use usesresourcelock trait
The text was updated successfully, but these errors were encountered: