Skip to content

Commit 8e6cf9c

Browse files
Copilothotlong
andcommitted
Address code review: derive maxHistory in mock, improve JSDoc on drag constant
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b8228a1 commit 8e6cf9c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

apps/console/src/__tests__/ViewConfigPanel.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ vi.mock('@object-ui/components', () => {
2727

2828
// useConfigDraft mock — mirrors real implementation
2929
function useConfigDraft(source: any, options?: any) {
30+
const maxHistory = options?.maxHistory ?? 50;
3031
const [draft, setDraft] = React.useState({ ...source });
3132
const [isDirty, setIsDirty] = React.useState(options?.mode === 'create');
3233
const pastRef = React.useRef<any[]>([]);
@@ -42,7 +43,7 @@ vi.mock('@object-ui/components', () => {
4243

4344
const updateField = React.useCallback((field: string, value: any) => {
4445
setDraft((prev: any) => {
45-
pastRef.current = [...pastRef.current.slice(-49), prev];
46+
pastRef.current = [...pastRef.current.slice(-(maxHistory - 1)), prev];
4647
futureRef.current = [];
4748
return { ...prev, [field]: value };
4849
});

apps/console/src/utils/view-config-schema.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function ExpandableWidget({ renderSummary, children }: {
6363
// Sortable column item — drag-to-reorder within the field selector
6464
// ---------------------------------------------------------------------------
6565

66-
/** Minimum drag distance in pixels to activate column reorder */
66+
/** Minimum pointer movement in pixels before drag-to-reorder activates (prevents accidental drags on click) */
6767
const COLUMN_DRAG_ACTIVATION_DISTANCE = 5;
6868

6969
function SortableColumnItem({ colName, label, idx, total, onToggle, onMove }: {

0 commit comments

Comments
 (0)