feat(draft): add local autosave + restore prompt + publish label
This commit is contained in:
@@ -63,6 +63,9 @@ interface SpecStoreActions {
|
||||
// WebSocket integration - set spec directly without API call
|
||||
setSpecFromWebSocket: (spec: AtomizerSpec, studyId?: string) => void;
|
||||
|
||||
// Local draft integration (S2) - set spec locally (no API call) and mark dirty
|
||||
setSpecLocalDraft: (spec: AtomizerSpec, studyId?: string) => void;
|
||||
|
||||
// Full spec operations
|
||||
saveSpec: (spec: AtomizerSpec) => Promise<void>;
|
||||
replaceSpec: (spec: AtomizerSpec) => Promise<void>;
|
||||
@@ -402,6 +405,20 @@ export const useSpecStore = create<SpecStore>()(
|
||||
});
|
||||
},
|
||||
|
||||
// Set spec locally as a draft (no API call). This is used by DraftManager (S2).
|
||||
// Marks the spec as dirty to indicate "not published".
|
||||
setSpecLocalDraft: (spec: AtomizerSpec, studyId?: string) => {
|
||||
const currentStudyId = studyId || get().studyId;
|
||||
console.log('[useSpecStore] Setting spec from local draft:', spec.meta?.study_name);
|
||||
set({
|
||||
spec,
|
||||
studyId: currentStudyId,
|
||||
isLoading: false,
|
||||
isDirty: true,
|
||||
error: null,
|
||||
});
|
||||
},
|
||||
|
||||
// =====================================================================
|
||||
// Full Spec Operations
|
||||
// =====================================================================
|
||||
|
||||
Reference in New Issue
Block a user