fix: memoize ishome and use routes
This commit is contained in:
parent
37d7b2a48b
commit
af9063dc41
2 changed files with 8 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { OnboardingModes } from "core/protocol/core";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { useContext, useEffect, useMemo, useState } from "react";
|
||||
import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { CustomScrollbarDiv } from ".";
|
||||
|
|
@ -54,8 +54,12 @@ const Layout = () => {
|
|||
|
||||
const showDialog = useAppSelector((state) => state.ui.showDialog);
|
||||
const isInEdit = useAppSelector((store) => store.session.isInEdit);
|
||||
const isHome =
|
||||
location.pathname === "/" || location.pathname === "/index.html";
|
||||
const isHome = useMemo(() => {
|
||||
return (
|
||||
location.pathname === ROUTES.HOME ||
|
||||
location.pathname === ROUTES.HOME_INDEX
|
||||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export type ConfigTab =
|
|||
// TODO: Move all the routes here
|
||||
export const ROUTES = {
|
||||
HOME: "/",
|
||||
HOME_INDEX: "/index.html",
|
||||
CONFIG: "/config",
|
||||
THEME: "/theme",
|
||||
STATS: "/stats",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue