mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Memoize some editor React components (#28963)
GitOrigin-RevId: 6440df9ac3ef1bf1839dff07eb2f55b52b581d3e
This commit is contained in:
@@ -7,20 +7,20 @@ import { OLToast } from '@/shared/components/ol/ol-toast'
|
||||
import { OLToastContainer } from '@/shared/components/ol/ol-toast-container'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
import useTutorial from '@/shared/hooks/promotions/use-tutorial'
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { sendMB } from '@/infrastructure/event-tracking'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type EditorSurveyPage = 'ease-of-use' | 'meets-my-needs' | 'thank-you'
|
||||
|
||||
export default function EditorSurvey() {
|
||||
export default memo(function EditorSurvey() {
|
||||
return (
|
||||
<OLToastContainer className="editor-survey-toast">
|
||||
<EditorSurveyContent />
|
||||
</OLToastContainer>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
const TUTORIAL_KEY = 'editor-popup-ux-survey'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { OLToast, OLToastProps } from '@/shared/components/ol/ol-toast'
|
||||
import useEventListener from '@/shared/hooks/use-event-listener'
|
||||
import { Fragment, ReactElement, useCallback, useState } from 'react'
|
||||
import { Fragment, memo, ReactElement, useCallback, useState } from 'react'
|
||||
|
||||
import { debugConsole } from '@/utils/debugging'
|
||||
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
||||
@@ -30,7 +30,7 @@ const GENERATOR_MAP: Map<string, GlobalToastGenerator> = new Map(
|
||||
|
||||
let toastCounter = 1
|
||||
|
||||
export const GlobalToasts = () => {
|
||||
export const GlobalToasts = memo(function GlobalToasts() {
|
||||
const [toasts, setToasts] = useState<
|
||||
{ component: ReactElement; id: string }[]
|
||||
>([])
|
||||
@@ -96,4 +96,4 @@ export const GlobalToasts = () => {
|
||||
))}
|
||||
</OLToastContainer>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user