mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(editor): close post-commit ref window
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* oxlint-disable max-lines -- Why: content loading, retry, and external-change
|
||||
subscriptions share in-flight caches and state setters; splitting them would
|
||||
make the hook coordination harder to audit. */
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import { getConnectionIdForFile, isWorktreeConnectionResolved } from '@/lib/connection-context'
|
||||
import { joinPath } from '@/lib/path'
|
||||
@@ -133,7 +133,7 @@ export function useEditorPanelContentState({
|
||||
const activeContentFileId = selectedConflictReviewFile?.id ?? activeFile?.id ?? null
|
||||
const activeContentFileIdRef = useRef(activeContentFileId)
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
// Why: event-driven readers must only observe state from committed renders.
|
||||
diffContentsRef.current = diffContents
|
||||
openFilesRef.current = openFiles
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { act, useEffect, useRef, useState } from 'react'
|
||||
import { act, useLayoutEffect, useRef, useState } from 'react'
|
||||
import { createRoot, type Root } from 'react-dom/client'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
@@ -30,7 +30,7 @@ function ExternalContentProbe({ activeFileId, calls, isVisible, openFiles }: Pro
|
||||
const [, setFileContents] = useState<Record<string, FileContent>>({})
|
||||
const [, setDiffContents] = useState<Record<string, DiffContent>>({})
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
activeContentFileIdRef.current = activeFileId
|
||||
isVisibleRef.current = isVisible
|
||||
openFilesRef.current = openFiles
|
||||
|
||||
Reference in New Issue
Block a user