diff --git a/docs/guide/manual-visits.md b/docs/guide/manual-visits.md index 4566c5a..8c95d06 100644 --- a/docs/guide/manual-visits.md +++ b/docs/guide/manual-visits.md @@ -15,9 +15,17 @@ router.visit(url, { preserveState: false, preserveScroll: false, only: [], + except: [], headers: {}, errorBag: null, forceFormData: false, + queryStringArrayFormat: 'brackets', + async: false, + showProgress: true, + fresh: false, + reset: [], + preserveUrl: false, + prefetch: false, onCancelToken: (cancelToken) => {}, onCancel: () => {}, onBefore: (visit) => {}, @@ -26,6 +34,8 @@ router.visit(url, { onSuccess: (page) => {}, onError: (errors) => {}, onFinish: (visit) => {}, + onPrefetching: () => {}, + onPrefetched: () => {}, }) ``` @@ -41,9 +51,17 @@ router.visit(url, { preserveState: false, preserveScroll: false, only: [], + except: [], headers: {}, errorBag: null, forceFormData: false, + queryStringArrayFormat: 'brackets', + async: false, + showProgress: true, + fresh: false, + reset: [], + preserveUrl: false, + prefetch: false, onCancelToken: (cancelToken) => {}, onCancel: () => {}, onBefore: (visit) => {}, @@ -52,6 +70,8 @@ router.visit(url, { onSuccess: (page) => {}, onError: (errors) => {}, onFinish: (visit) => {}, + onPrefetching: () => {}, + onPrefetched: () => {}, }) ``` @@ -67,9 +87,17 @@ router.visit(url, { preserveState: false, preserveScroll: false, only: [], + except: [], headers: {}, errorBag: null, forceFormData: false, + queryStringArrayFormat: 'brackets', + async: false, + showProgress: true, + fresh: false, + reset: [], + preserveUrl: false, + prefetch: false, onCancelToken: (cancelToken) => {}, onCancel: () => {}, onBefore: (visit) => {}, @@ -78,6 +106,8 @@ router.visit(url, { onSuccess: (page) => {}, onError: (errors) => {}, onFinish: (visit) => {}, + onPrefetching: () => {}, + onPrefetched: () => {}, }) ``` diff --git a/docs/guide/progress-indicators.md b/docs/guide/progress-indicators.md index 1d7a6e6..dce68d0 100644 --- a/docs/guide/progress-indicators.md +++ b/docs/guide/progress-indicators.md @@ -1,6 +1,6 @@ # Progress indicators -Since Inertia requests are made via XHR, there would typically not be a browser loading indicator when navigating from one page to another. To solve this, Inertia displays a progress indicator at the top of the page whenever you make an Inertia visit. +Since Inertia requests are made via XHR, there would typically not be a browser loading indicator when navigating from one page to another. To solve this, Inertia displays a progress indicator at the top of the page whenever you make an Inertia visit. However, [asynchronous requests](#visit-options) do not show the progress indicator unless explicitly configured. Of course, if you prefer, you can disable Inertia's default loading indicator and provide your own custom implementation. We'll discuss both approaches below. @@ -294,3 +294,26 @@ router.on('finish', (event) => { ``` ::: + +## Visit Options + +In addition to these configurations, Inertia.js provides two visit options to control the loading indicator on a per-request basis: `showProgress` and `async`. These options offer greater control over how Inertia.js handles asynchronous requests and manages progress indicators. + +### `showProgress` + +The `showProgress` option provides fine-grained control over the visibility of the loading indicator during requests. + +```js +router.get('/settings', {}, { showProgress: false }) +``` + +### `async` + +The `async` option allows you to perform asynchronous requests without displaying the default progress indicator. It can be used in combination with the `showProgress` option. + +```js +// Disable the progress indicator +router.get('/settings', {}, { async: true }) +// Enable the progress indicator with async requests +router.get('/settings', {}, { async: true, showProgress: true }) +```