diff --git a/packages/ui/src/makerkit/top-loading-bar-indicator.tsx b/packages/ui/src/makerkit/top-loading-bar-indicator.tsx
index 241c4a9d1..0b6c93090 100644
--- a/packages/ui/src/makerkit/top-loading-bar-indicator.tsx
+++ b/packages/ui/src/makerkit/top-loading-bar-indicator.tsx
@@ -1,35 +1,31 @@
'use client';
-import { createRef, useEffect, useRef } from 'react';
+import { createRef, useEffect } from 'react';
import type { LoadingBarRef } from 'react-top-loading-bar';
import LoadingBar from 'react-top-loading-bar';
-export function TopLoadingBarIndicator({
- completeOnUnmount = true,
-}: {
- completeOnUnmount?: boolean;
-}) {
+let running = false;
+
+export function TopLoadingBarIndicator() {
const ref = createRef();
- const runningRef = useRef(false);
useEffect(() => {
- if (!ref.current || runningRef.current) {
+ if (!ref.current || running) {
return;
}
+ running = true;
+
const loadingBarRef = ref.current;
- loadingBarRef.continuousStart(0, 250);
- runningRef.current = true;
+ loadingBarRef.continuousStart(0, 300);
return () => {
- if (completeOnUnmount) {
- loadingBarRef.complete();
- }
- runningRef.current = false;
+ loadingBarRef.complete();
+ running = false;
};
- }, [completeOnUnmount, ref]);
+ }, [ref]);
return (