♻️ (headerComponent): increase route history slice size to 100 for better navigation tracking

🐛 (locationStore): update route history limit to 100 to prevent excessive memory usage
This commit is contained in:
cristhianzl 2024-06-10 17:33:36 -03:00
commit 035cf54d2f
2 changed files with 3 additions and 3 deletions

View file

@ -68,8 +68,8 @@ export default function Header(): JSX.Element {
};
const visitedFlowPathBefore = () => {
const lastThreeVisitedPaths = routeHistory.slice(-3);
return lastThreeVisitedPaths.some((path) => path.includes("/flow/"));
const last100VisitedPaths = routeHistory.slice(-99);
return last100VisitedPaths.some((path) => path.includes("/flow/"));
};
const showArrowReturnIcon =

View file

@ -7,7 +7,7 @@ export const useLocationStore = create<LocationStoreType>((set, get) => ({
let routeHistoryArray = get().routeHistory;
routeHistoryArray.push(location);
if (routeHistoryArray?.length > 9) {
if (routeHistoryArray?.length > 100) {
routeHistoryArray.shift();
set({
routeHistory: routeHistoryArray,