diff --git a/resources/js/Pages/progress-indicators.jsx b/resources/js/Pages/progress-indicators.jsx index 0d5b6600..25fd59c5 100644 --- a/resources/js/Pages/progress-indicators.jsx +++ b/resources/js/Pages/progress-indicators.jsx @@ -1,10 +1,11 @@ -import { A, Code, CodeBlock, H1, H2, H3, P, TabbedCode } from '@/Components' +import { A, Code, CodeBlock, H1, H2, H3, Notice, P, TabbedCode } from '@/Components' import dedent from 'dedent-js' export const meta = { title: 'Progress indicators', links: [ { url: '#default', name: 'Default' }, + { url: '#programmatic-access', name: 'Programmatic access' }, { url: '#custom', name: 'Custom' }, { url: '#visit-options', name: 'Visit Options' }, ], @@ -64,6 +65,94 @@ export default function () { }) `} /> +

Programmatic access

+

+ When you need to control the progress indicator outside of Inertia requests, for example, when making requests with + Axios or other libraries, you can use Inertia's progress methods directly. +

+ +

+ The hide() and reveal() methods work together to prevent conflicts when separate + parts of your code need to control progress visibility. Each hide() call increments an internal counter, + while reveal() decrements it. The progress bar only appears when this counter reaches zero. +

+

+ However, reveal() accepts an optional force parameter that bypasses this counter. + Inertia uses this pattern internally to hide progress during prefetching while ensuring it appears for actual navigation. +

+