Multiple Unexpected Fetch Requests Triggered When Closing Modal After Create Action
Package
Actions
Package Version
v3.2
How can we help you?
Problem:
I have a simple resource with a create action. To enhance user experience, I've disabled the create page route and instead made the action open in a modal.
Expected Behavior:
- Upon clicking the "Create" button, it should trigger a single fetch request for creating the resource.
- Closing the modal or clicking away should not trigger additional fetch requests.
- Users should be able to open the modal again without waiting for any pending requests to finish.
Current Behavior:
- Clicking the "Create" button initiates a fetch request named "update".
- Upon closing the modal or clicking away, two more identical fetch requests are triggered, causing unnecessary load and preventing the modal from reopening until all three requests are completed.
- These fetch requests take some time, significantly slowing down the app especially if the user has a slow network.
Steps to Reproduce:
1. Navigate to the resource.
2. Click the "Create" button to open the modal.
3. Observe the network requests initiated.
4. Close the modal or click away from it.
5. Observe additional fetch requests being triggered.
3 Replies
Are you using the default Resource CreateRecord page of the Resource or creating a new external livewire page for the modal?
I think it is a normal behaviour using a Resource Page, where the livewire update will be called every click. This does not happen if creating new Livewire component for this page separately.
i just comment out the create page and did some changes to the create action model like this
.