Fixed track collision bug

This commit is contained in:
patben8 committed 2026-09-30 15:54:49 +02:00
1 parent 3c4238f60c
commit 387f97853d
7 files changed
+236 -34

No files matched your search

+4
View File
@@ -556,6 +556,10 @@ export interface RemapPreview {
matched: number
existing: number
samples: RemapSample[]
/** Target paths more than one track would land on. Non-zero = the rewrite
* would be refused (two entries sharing a path corrupt the library). */
collisions: number
collision_samples: string[]
}
/** One place a stored volume's tracks were found — a mapping the user can pick. */
+17 -1
View File
@@ -102,7 +102,10 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
}
}
const canCommit = !!from.trim() && !!to.trim()
// The backend refuses a rewrite that would give two tracks one path; say so
// here rather than only after the click.
const collides = (preview?.collisions ?? 0) > 0
const canCommit = !!from.trim() && !!to.trim() && !collides
return createPortal(
<div
@@ -191,6 +194,19 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
{preview.matched} exist at the target.
</span>
)}
{collides && (
<div className="mt-1.5 text-pink">
{preview.collisions} target path{preview.collisions === 1 ? '' : 's'} would
belong to more than one track, so the paths can’t be rewritten:
<ul className="mt-1 list-disc pl-4 text-muted">
{preview.collision_samples.map((p) => (
<li key={p} className="truncate" title={p}>
{p}
</li>
))}
</ul>
</div>
)}
</div>
)}