mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Merge pull request #20785 from overleaf/dp-sticky-highlights
Clear op highlight on review-panel-entry dismount GitOrigin-RevId: 9892df75f35fcb0440bd19bcfbaa276a3db033a1
This commit is contained in:
parent
551de499d5
commit
4480a986a3
1 changed files with 10 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import { FC, useCallback, useState } from 'react'
|
||||
import { FC, useCallback, useEffect, useState } from 'react'
|
||||
import { AnyOperation } from '../../../../../types/change'
|
||||
import {
|
||||
useCodeMirrorStateContext,
|
||||
|
@ -44,6 +44,15 @@ export const ReviewPanelEntry: FC<{
|
|||
setFocused(true)
|
||||
}, [selectLineOnFocus, docId, openDocId, position])
|
||||
|
||||
// Clear op highlight on dismount
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (hoverRanges) {
|
||||
view.dispatch(clearHighlightRanges(op))
|
||||
}
|
||||
}
|
||||
}, []) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<div
|
||||
onFocus={focusHandler}
|
||||
|
|
Loading…
Reference in a new issue