From 2f9a7f9a2161ee6f149991e6b44ee69b4e55f50c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 2 Jul 2024 18:30:34 -0400 Subject: [PATCH] Remove random color on document icons, closes #7181 --- app/scenes/Document/components/Editor.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/scenes/Document/components/Editor.tsx b/app/scenes/Document/components/Editor.tsx index f827efc20..a7254d88b 100644 --- a/app/scenes/Document/components/Editor.tsx +++ b/app/scenes/Document/components/Editor.tsx @@ -1,10 +1,10 @@ +import last from "lodash/last"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { mergeRefs } from "react-merge-refs"; import { useHistory, useRouteMatch } from "react-router-dom"; import { richExtensions, withComments } from "@shared/editor/nodes"; -import { randomElement } from "@shared/random"; import { TeamPreference } from "@shared/types"; import { colorPalette } from "@shared/utils/collections"; import Comment from "~/models/Comment"; @@ -93,10 +93,7 @@ function DocumentEditor(props: Props, ref: React.RefObject) { } = props; const can = usePolicy(document); - const iconColor = React.useMemo( - () => document.color ?? randomElement(colorPalette), - [document.color] - ); + const iconColor = document.color ?? last(colorPalette); const childRef = React.useRef(null); const focusAtStart = React.useCallback(() => { if (ref.current) {