mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 10:12:34 +00:00
Fix dataset-ref walk false positive and wire spec-mandated success toasts
- Prune the data payload and top-level datasets keys in all three ref walks (extractDatasetRefs, renameDatasetInSpec, resolveDatasetRefs) so a data row carrying a field named "data" is no longer misread as a library reference, spuriously rewritten, or made to throw DatasetNotFoundError. Adds tests, including a guard that lookup-transform refs (from.data) still resolve. - Wire the deferred success toasts now the Toaster has landed: publish, revert, extract-to-dataset, and snippet/dataset delete. Copy follows the council title-vs-message rule (title states the action, message adds the consequence). - Reconcile the spec's blanket toast mandate to "toast only what the user can't already see": no toast on visible-result creates (snippet, dataset form); Copy Reference stays inline and gains an aria-live announcement (new shared .visually-hidden utility) instead of a toast-per-copy. - Move the toast region to bottom-right so it stops covering the header action cluster (Publish/Revert, theme/datasets). - Update docs/spec 01F/02/05 and docs/architecture/07 + 10 to match.
This commit is contained in:
@@ -221,6 +221,10 @@ export const useDatasetStore = create<DatasetState>((set, get) => ({
|
||||
now,
|
||||
});
|
||||
get().add(dataset);
|
||||
// Switching to the detail view with the new dataset selected IS the success
|
||||
// confirmation, so no toast is raised — the result is on-screen (spec §05;
|
||||
// docs/architecture/10 → Toast copy). Extract-to-dataset, which creates a
|
||||
// dataset off-screen, does toast (see ExtractStore).
|
||||
set({ view: 'detail', form: EMPTY_FORM, formError: null });
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -17,6 +17,7 @@ import type { DataFormat } from '@core/format-detection';
|
||||
import { createDataset } from '@core/dataset';
|
||||
import { isNameTaken } from '@core/naming';
|
||||
import { useDatasetStore } from './DatasetStore';
|
||||
import { notify } from './NotificationStore';
|
||||
import { useSnippetStore } from './SnippetStore';
|
||||
|
||||
/** The inline `data` block of a parsed spec, if it carries `values`. */
|
||||
@@ -123,8 +124,14 @@ export const useExtractStore = create<ExtractState>((set, get) => ({
|
||||
spec.data = { name };
|
||||
useSnippetStore.getState().replaceActiveDraft(JSON.stringify(spec, null, 2), now);
|
||||
|
||||
// TODO (M6, spec §03F): success toast "Dataset created" — deferred with the
|
||||
// other success toasts (see SnippetStore publish/revert breadcrumbs).
|
||||
// Success confirmation (spec §03F). Title states the action; the message
|
||||
// adds the consequence — the spec was rewritten to reference the new dataset
|
||||
// by name (council toast-copy rule, docs/architecture/10 → Toast copy).
|
||||
notify({
|
||||
kind: 'success',
|
||||
title: 'Dataset created',
|
||||
message: `The spec now references "${name}" instead of its inline data.`,
|
||||
});
|
||||
set(INITIAL);
|
||||
return true;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user