Skip to content

Commit 2af65b9

Browse files
committed
fix: Coderabbit review comments
1 parent c5f4070 commit 2af65b9

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

packages/webui/src/client/lib/Escape.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function usePortal(id: string, style?: Partial<Record<keyof React.CSSProperties,
5454

5555
return function removeElement() {
5656
rootElemRef.current?.remove()
57-
rootElemRef.current = null
5857
if (parentCreatedByThisHook && !parentElem.childElementCount) {
5958
parentElem.remove()
6059
}
@@ -63,6 +62,13 @@ function usePortal(id: string, style?: Partial<Record<keyof React.CSSProperties,
6362
[id]
6463
)
6564

65+
useEffect(function cleanupOnUnmount() {
66+
return function removeOnUnmount() {
67+
rootElemRef.current?.remove()
68+
rootElemRef.current = null
69+
}
70+
}, [])
71+
6672
/**
6773
* It's important we evaluate this lazily:
6874
* - We need first render to contain the DOM element, so it shouldn't happen

packages/webui/src/client/lib/viewPort.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,11 @@ export function maintainFocusOnPartInstance(
5050
noAnimation?: boolean
5151
): void {
5252
focusState.startTime = Date.now()
53-
viewPortScrollingState.isProgrammaticScrollInProgress = true
54-
viewPortScrollingState.lastProgrammaticScrollTime = Date.now()
5553

5654
const focus = async () => {
5755
// Only proceed if we're not already scrolling and within the time window
5856
if (!focusState.isScrolling && Date.now() - focusState.startTime < timeWindow) {
5957
focusState.isScrolling = true
60-
viewPortScrollingState.lastProgrammaticScrollTime = Date.now()
6158

6259
try {
6360
await scrollToPartInstance(partInstanceId, forceScroll, noAnimation)

packages/webui/src/client/ui/SegmentTimeline/Renderers/VTSourceRenderer.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,16 @@ class VTSourceRendererBase extends CustomLayerItemRenderer<IProps & WithTranslat
216216
}
217217

218218
private hasStateChanges = (newState: Partial<IState>): boolean => {
219-
for (const [key, value] of Object.entries(newState)) {
220-
if (this.state[key as keyof IState] !== value) {
219+
const keys: Array<keyof IState> = [
220+
'rightLabelIsAppendage',
221+
'noticeLevel',
222+
'begin',
223+
'end',
224+
'sourceEndCountdownAppendage',
225+
]
226+
227+
for (const key of keys) {
228+
if (Object.prototype.hasOwnProperty.call(newState, key) && this.state[key] !== newState[key]) {
221229
return true
222230
}
223231
}

0 commit comments

Comments
 (0)