mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-27 04:10:03 -05:00
Compare commits
1 Commits
codex/cli-
...
v2025.2.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64f5d973eb |
@@ -12,6 +12,7 @@ import {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import type { XYCoord } from 'react-dnd';
|
import type { XYCoord } from 'react-dnd';
|
||||||
import { useDrag, useDrop } from 'react-dnd';
|
import { useDrag, useDrop } from 'react-dnd';
|
||||||
|
import { useRandomKey } from '../../hooks/useRandomKey';
|
||||||
import { useToggle } from '../../hooks/useToggle';
|
import { useToggle } from '../../hooks/useToggle';
|
||||||
import { languageFromContentType } from '../../lib/contentType';
|
import { languageFromContentType } from '../../lib/contentType';
|
||||||
import { showDialog } from '../../lib/dialog';
|
import { showDialog } from '../../lib/dialog';
|
||||||
@@ -107,6 +108,9 @@ export const PairEditor = forwardRef<PairEditorRef, PairEditorProps>(function Pa
|
|||||||
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
|
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
|
||||||
const [pairs, setPairs] = useState<PairWithId[]>([]);
|
const [pairs, setPairs] = useState<PairWithId[]>([]);
|
||||||
const [showAll, toggleShowAll] = useToggle(false);
|
const [showAll, toggleShowAll] = useToggle(false);
|
||||||
|
// NOTE: Use local force update key because we trigger an effect on forceUpdateKey change. If
|
||||||
|
// we simply pass forceUpdateKey to the editor, the data set by useEffect will be stale.
|
||||||
|
const [localForceUpdateKey, regenerateLocalForceUpdateKey] = useRandomKey();
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
ref,
|
ref,
|
||||||
@@ -136,6 +140,7 @@ export const PairEditor = forwardRef<PairEditorRef, PairEditorProps>(function Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
setPairs(newPairs);
|
setPairs(newPairs);
|
||||||
|
regenerateLocalForceUpdateKey();
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [forceUpdateKey]);
|
}, [forceUpdateKey]);
|
||||||
@@ -240,7 +245,7 @@ export const PairEditor = forwardRef<PairEditorRef, PairEditorProps>(function Pa
|
|||||||
forcedEnvironmentId={forcedEnvironmentId}
|
forcedEnvironmentId={forcedEnvironmentId}
|
||||||
forceFocusNamePairId={forceFocusNamePairId}
|
forceFocusNamePairId={forceFocusNamePairId}
|
||||||
forceFocusValuePairId={forceFocusValuePairId}
|
forceFocusValuePairId={forceFocusValuePairId}
|
||||||
forceUpdateKey={forceUpdateKey}
|
forceUpdateKey={localForceUpdateKey}
|
||||||
index={i}
|
index={i}
|
||||||
isLast={isLast}
|
isLast={isLast}
|
||||||
nameAutocomplete={nameAutocomplete}
|
nameAutocomplete={nameAutocomplete}
|
||||||
|
|||||||
Reference in New Issue
Block a user