fix(project-editor): close redo-staleness window, dedupe footer URL check
Some checks failed
Architecture Governance / architecture (push) Has been cancelled

Independent review pass over the Configuration Engine sprint (M1-M6).

- Facade: a fresh edit burst now clears the redo (future) stack immediately,
  not just once its debounced commit lands ~300ms later. Previously, editing
  right after an undo left canRedo() true for that window; clicking Redo
  during it would have silently discarded the new edit and jumped back to
  the stale future snapshot. Reordered two interspersed imports/interface
  for readability while in the file.
- footer-section: removed a local HTTP_URL regex + duplicate isValidUrl
  logic (its "shared/ui can't import features" justification didn't apply -
  this file already lives in features/project-editor/sections/, the same
  feature as schema/validators/). Now calls isValidHttpUrl from
  schema/validators/primitives, closing a validator duplication the sprint's
  "no duplicated validators" requirement was meant to catch.

Gate: tsc --noEmit, npm test (33/33), arch:check, build all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
sdarbinyan
2026-07-17 09:10:54 +04:00
parent 8d317f043c
commit 274f2a4101
2 changed files with 10 additions and 6 deletions

View File

@@ -12,6 +12,8 @@ import { ProjectValidator, ProjectValidationIssue } from '../services/project-va
import { ProjectEditorSectionId } from '../models/project-editor.model';
import { EditorSchemaService } from '../schema/editor-schema.service';
import { History, commit as commitHistory, emptyHistory, redo as redoHistory, undo as undoHistory } from '../schema/history.util';
import { ProjectEditorDraftStorageService } from '../services/project-editor-draft-storage.service';
import { EDITOR_SECTION_BOOTSTRAP_KEYS } from '../models/project-editor.model';
const HISTORY_DEBOUNCE_MS = 300;
@@ -23,8 +25,6 @@ export interface ChangeSummaryRow {
readonly before: string;
readonly after: string;
}
import { ProjectEditorDraftStorageService } from '../services/project-editor-draft-storage.service';
import { EDITOR_SECTION_BOOTSTRAP_KEYS } from '../models/project-editor.model';
@Injectable({ providedIn: 'root' })
export class ProjectEditorFacade {
@@ -195,8 +195,14 @@ export class ProjectEditorFacade {
// Capture the pre-burst snapshot so a run of rapid edits collapses into one
// undo step. The baseline is cleared when the debounce fires (or on undo).
// A fresh burst also invalidates any redo stack immediately (not just once
// the debounced commit lands) - otherwise Redo would stay enabled for up to
// HISTORY_DEBOUNCE_MS after a post-undo edit and silently discard it.
if (this.pendingBaseline === null) {
this.pendingBaseline = current;
if (this.history().future.length > 0) {
this.history.update(history => ({ ...history, future: [] }));
}
}
const next = this.normalize(updater(JSON.parse(JSON.stringify(current)) as BootstrapConfig));
this.state.update(state => ({ ...state, bootstrap: next, draftRestored: false }));