File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,4 +96,5 @@ export const REACT_COMPILED_FILES = [
9696 "apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx" ,
9797 "apps/web/src/components/ThreadTerminalDrawer.tsx" ,
9898 "apps/web/src/components/settings/SettingsPanels.tsx" ,
99+ "apps/web/src/components/chat/markdownFindContext.ts" ,
99100] as const ;
Original file line number Diff line number Diff line change 1- import { createContext , useCallback } from "react" ;
1+ import { createContext } from "react" ;
22
33// While find is active, folded content stays mounted (hidden) so its text can be
44// matched. Nothing opens until the selected match lies inside it.
@@ -9,12 +9,11 @@ export const MarkdownFindContext = createContext(false);
99 * match, like the browser's own find-in-page. `onReveal` must be stable.
1010 */
1111export function useFindRevealRef ( onReveal : ( ) => void ) {
12- return useCallback (
13- ( element : HTMLElement | null ) => {
14- if ( ! element ) return ;
15- element . addEventListener ( "beforematch" , onReveal ) ;
16- return ( ) => element . removeEventListener ( "beforematch" , onReveal ) ;
17- } ,
18- [ onReveal ] ,
19- ) ;
12+ // The compiler skips hookless functions; a new ref callback each render would re-add the listener.
13+ "use memo" ;
14+ return ( element : HTMLElement | null ) => {
15+ if ( ! element ) return ;
16+ element . addEventListener ( "beforematch" , onReveal ) ;
17+ return ( ) => element . removeEventListener ( "beforematch" , onReveal ) ;
18+ } ;
2019}
You can’t perform that action at this time.
0 commit comments