mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Track datasetRefs against the live draft so manual edits and extract link immediately
This commit is contained in:
@@ -283,8 +283,8 @@ export function reassignCollidingSnippetIds(
|
||||
* Propagate dataset renames (from `dedupeIncomingDatasetNames`) into the imported
|
||||
* snippets that reference them (architecture 07 §6): for each rename, rewrite both
|
||||
* `spec` and `draftSpec` via `renameDatasetInSpec`, then recompute `datasetRefs`
|
||||
* from the rewritten spec — the spec is the source of truth, `datasetRefs` mirrors
|
||||
* it. Matching is case-insensitive (consistent with the naming helpers). Only
|
||||
* from the rewritten draft — the draft is the source of truth, `datasetRefs`
|
||||
* mirrors it. Matching is case-insensitive (consistent with the naming helpers). Only
|
||||
* snippets that actually change are cloned.
|
||||
*
|
||||
* Applied to the imported set ONLY — existing snippets keep their references,
|
||||
@@ -323,7 +323,8 @@ export function applyDatasetRenamesToSnippets(
|
||||
draftSpec = renameDatasetInSpec(draftSpec, oldName, to);
|
||||
}
|
||||
|
||||
return { ...snippet, spec, draftSpec, datasetRefs: recomputeDatasetRefs(spec) };
|
||||
// datasetRefs mirrors the draft — the version the editor shows (arch 07 §3).
|
||||
return { ...snippet, spec, draftSpec, datasetRefs: recomputeDatasetRefs(draftSpec) };
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -40,7 +40,9 @@ export interface Snippet {
|
||||
comment: string;
|
||||
/** User-assigned labels. */
|
||||
tags: string[];
|
||||
/** Names of datasets referenced by this spec (maintained on publish). */
|
||||
/** Names of datasets referenced by the draft spec; mirrors the version being
|
||||
* edited, recomputed on every draft change (create/auto-save/extract/revert)
|
||||
* and on publish (docs/architecture/07 §3). */
|
||||
datasetRefs: string[];
|
||||
/** Free-form, extensible metadata bag. */
|
||||
meta: Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user