diff --git a/src/features/bookmarks/bookmark.tsx b/src/features/bookmarks/bookmark.tsx index 004768c2..41dc96fb 100644 --- a/src/features/bookmarks/bookmark.tsx +++ b/src/features/bookmarks/bookmark.tsx @@ -15,7 +15,7 @@ import { useTheme, } from "@mui/material"; import { css } from "@mui/styled-engine"; -import { MouseEvent, useState } from "react"; +import { memo, MouseEvent, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; @@ -69,6 +69,22 @@ const Img = styled("img")( ); export function Bookmark({ bookmark }: { bookmark: ExtendedBookmark }) { + // createBookmark changes all the time (could add useCallback there but it depends on mainObjects, + // so going to change all the time anyway), so just pass it as a ref to avoid rerendering + const createBookmark = useCreateBookmark(); + const createBookmarkRef = useRef(createBookmark); + return ; +} + +const BookmarkInnerMemoized = memo(BookmarkInner); + +function BookmarkInner({ + bookmark, + createBookmark, +}: { + bookmark: ExtendedBookmark; + createBookmark: ReturnType; +}) { const { state: { canvas }, } = useExplorerGlobals(true); @@ -77,7 +93,6 @@ export function Bookmark({ bookmark }: { bookmark: ExtendedBookmark }) { const history = useHistory(); const [menuAnchor, setMenuAnchor] = useState(null); const selectBookmark = useSelectBookmark(); - const createBookmark = useCreateBookmark(); const dispatch = useAppDispatch(); const bookmarks = useAppSelector(selectBookmarks); const sceneId = useSceneId(); diff --git a/src/features/bookmarks/collection.tsx b/src/features/bookmarks/collection.tsx index a462f3c1..82140c26 100644 --- a/src/features/bookmarks/collection.tsx +++ b/src/features/bookmarks/collection.tsx @@ -58,6 +58,7 @@ export function Collection({ collection, bookmarks }: { collection: string; book : dispatch(bookmarksActions.closeCollection(collection)) } level={currentDepth} + slotProps={{ transition: { unmountOnExit: true } }} > diff --git a/src/features/properties/routes/root.tsx b/src/features/properties/routes/root.tsx index d5c2a2c0..73968fd6 100644 --- a/src/features/properties/routes/root.tsx +++ b/src/features/properties/routes/root.tsx @@ -446,7 +446,7 @@ function PropertyList({ {accordions.map((accordion) => ( - + {decodeURIComponent(accordion.name)}