-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Bug Report
Description
I am requesting the addition of the standard Inertia.js lifecycle events (onStart, onFinish, onSuccess, and onError) as arguments to the reload slot prop function within the Modal component.
When utilizing the reload slot prop to trigger a page reload after an action within the modal, I have limited visibility into the navigation state. This makes it challenging to implement common UI patterns like:
Showing a loading indicator when the reload request starts (onStart).
Hiding the loading indicator regardless of the outcome (onFinish).
Displaying a success message or closing the modal when the reload is complete and successful (onSuccess).
Handling and logging an error if the navigation fails (onError).
Steps To Reproduce
<script setup>
defineProps(['permissions'])
performReload = (reload) => {
reload({
only: ['permissions'] },
onStart: () => console.log('started'),
onSuccess: () => console.log('success')
})
}
</script>
<template>
<Modal #default="{ reload }">
<button @click="performReload(reload)">
Reload permissions
</button>
</Modal>
</template>
Expected Behavior
Console log with "started"
Actual Behavior
Nothing happens