mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
195328f7a6
* Persist saved annotate file edits in drafts * Handle stale saved file edit context * Test source edit conflict actions * Return source metadata for single-file docs * Fix saved file edit conflict races * Handle deleted source files in annotate edits * Tighten annotate missing-file recovery * Reset edit state for missing file reopen * Tighten source edit restore path handling * Harden source edit recovery paths * Harden source edit disk reconciliation * Fix live file tree startup delay * Document file tree watcher startup ordering * Preserve source save through missing files and symlinks * Harden missing source file recovery * Tighten annotate source edit boundaries
14 lines
525 B
TypeScript
14 lines
525 B
TypeScript
import type { DraftEditedDocument } from '@plannotator/ui/hooks/useAnnotationDraft';
|
|
|
|
export function pickRestoredSingleFileDraftToDisplay(
|
|
documents: DraftEditedDocument[],
|
|
restoredKeys: string[],
|
|
activeKey: string | null,
|
|
): DraftEditedDocument | undefined {
|
|
const restored = documents.filter((doc) =>
|
|
doc.sourceSave.scope === 'single-file' && restoredKeys.includes(doc.key)
|
|
);
|
|
if (activeKey) return restored.find((doc) => doc.key === activeKey);
|
|
return restored.length === 1 ? restored[0] : undefined;
|
|
}
|