Skip to content

Commit e85937f

Browse files
authored
Feature: Add navigation.isLoading state to core/router store (#67680)
1 parent 9da58a7 commit e85937f

File tree

1 file changed

+4
-0
lines changed
  • packages/interactivity-router/src

1 file changed

+4
-0
lines changed

packages/interactivity-router/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ interface Store {
223223
state: {
224224
url: string;
225225
navigation: {
226+
isLoading: boolean;
226227
hasStarted: boolean;
227228
hasFinished: boolean;
228229
};
@@ -237,6 +238,7 @@ export const { state, actions } = store< Store >( 'core/router', {
237238
state: {
238239
url: window.location.href,
239240
navigation: {
241+
isLoading: false,
240242
hasStarted: false,
241243
hasFinished: false,
242244
},
@@ -289,6 +291,7 @@ export const { state, actions } = store< Store >( 'core/router', {
289291
return;
290292
}
291293

294+
navigation.isLoading = true;
292295
if ( loadingAnimation ) {
293296
navigation.hasStarted = true;
294297
navigation.hasFinished = false;
@@ -328,6 +331,7 @@ export const { state, actions } = store< Store >( 'core/router', {
328331

329332
// Update the navigation status once the the new page rendering
330333
// has been completed.
334+
navigation.isLoading = false;
331335
if ( loadingAnimation ) {
332336
navigation.hasStarted = false;
333337
navigation.hasFinished = true;

0 commit comments

Comments
 (0)