Merge pull request #31909 from overleaf/ds-removing-useIsNewEditorEnabled-2

[Part 2] Removing the usage of `useIsNewEditorEnabled` for editor tear down

GitOrigin-RevId: 864652da0edcedab4f3b1ba47d8d42fb65260118
This commit is contained in:
Davinder Singh
2026-03-06 09:15:30 +00:00
committed by Copybot
parent 5dae580a42
commit d6e745c156
9 changed files with 21 additions and 163 deletions
@@ -1,4 +1,3 @@
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
import {
Segmentation,
sendMB,
@@ -10,22 +9,17 @@ import { useCallback } from 'react'
export function populateEditorRedesignSegmentation<
SegmentationType extends Segmentation,
>(
segmentation: SegmentationType | undefined = {} as SegmentationType,
editorRedesign: boolean
segmentation: SegmentationType | undefined = {} as SegmentationType
): SegmentationType & { 'editor-redesign'?: 'enabled' } {
return editorRedesign
? { ...segmentation, 'editor-redesign': 'enabled' }
: segmentation
return { ...segmentation, 'editor-redesign': 'enabled' }
}
export const useEditorAnalytics = () => {
const editorRedesign = useIsNewEditorEnabled()
const populateSegmentation = useCallback(
(segmentation: Segmentation | undefined = {}): Segmentation => {
return populateEditorRedesignSegmentation(segmentation, editorRedesign)
return populateEditorRedesignSegmentation(segmentation)
},
[editorRedesign]
[]
)
const sendEvent: typeof sendMB = useCallback(