From 09caf4bc3fe3ca3f49da748247ce3a85cf1d2583 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 17 Oct 2026 03:18:04 +0000 Subject: [PATCH] fix(tours): sorts that name their order, the note focused without autofocus The checklist and the obstacle data sorted texts without a compare function. They now sort by code units through one shared compareCodeUnits, the order a bare sort gave, the same on every machine; the material data of a lock's parts no longer orders by the server's locale, so its hash cannot change with it. The note editor takes the focus through a ref instead of autoFocus, a direct function reference in a map becomes a call, and the GPX import's default fields are a named constant. --- .../Tours/paddle/ObstacleDecisionPanel.tsx | 9 +++++++-- .../Tours/paddle/PaddleObstacleNotice.tsx | 3 ++- server/src/nest/paddle-obstacles/paddle-extract.ts | 6 +++--- server/src/nest/tours/tour-paddle-check.service.ts | 5 +++-- server/src/nest/tours/tours.service.ts | 5 ++++- shared/src/common/compare.spec.ts | 13 +++++++++++++ shared/src/common/compare.ts | 9 +++++++++ shared/src/index.ts | 1 + shared/src/tours/paddle-check-basis.ts | 5 +++-- shared/src/tours/paddle-check.ts | 5 +++-- 10 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 shared/src/common/compare.spec.ts create mode 100644 shared/src/common/compare.ts diff --git a/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx b/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx index f2cfa6281..96195e51a 100644 --- a/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx +++ b/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx @@ -18,7 +18,7 @@ import { Unlink, X, } from 'lucide-react'; -import { useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'; +import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'; import { useTranslation } from '../../../i18n'; import { fs } from '../../shared/DialogShell'; import { Tooltip } from '../../shared/Tooltip'; @@ -197,6 +197,11 @@ function NoteEditor({ onCancel: () => void; }) { const { t } = useTranslation(); + const box = useRef(null); + // The note opens for writing, so it takes the focus once, when it opens. + useEffect(() => { + box.current?.focus(); + }, []); const onKeyDown = (event: KeyboardEvent) => { if (event.key !== 'Escape') return; // The map card and the dialog close on Escape; inside the note it only ends the edit. @@ -209,8 +214,8 @@ function NoteEditor({