feat: post-write consistency hardening (Stage 2A) #5
Loading…
Reference in New Issue
No description provided.
Delete Branch "feat/post-write-consistency"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR: feat/post-write-consistency → main
Objective
Stage 2A — Post-write consistency hardening. Make list/detail behavior predictable after edits and status changes, per the master development brief's Stage 2A requirements.
Inspection findings
The controller's
load()method re-fetched all drafts and re-applied filters/search/sort correctly, butselectedDraftwas only preserved acrossload()cycles — not after write-triggered reloads. After any write (updateStatus,updatePrice,updateName,updateDescription,updateCategory), the controller calledload()which resetselectedDraftvia_applyFilters(). The selected item's reference became stale (pointing to the pre-write snapshot) or was lost entirely when the item left an active filter. No existing tests covered post-write selection or state persistence.Implementation
Single change: Added a private
_refreshSelection()helper toProductPublishingController. After every write-triggeredload(), it re-finds the previously selected draft by id in the current filtereddraftslist. If found,selectedDraftis refreshed with the latest data. If the item left the visible set (e.g., status change moved it out of the active filter),selectedDraftfalls through toload()'s existing auto-select-first behavior.No domain model changes. No repository changes. No UI changes. No new public API. Constraints preserved: strict package boundaries, no scope broadening, small reviewable diff.
Changed files
.../product_publishing_controller.dart_refreshSelection()(~8 lines); wired intoload()and all 5 write methods.../product_publishing_controller_test.dartpost-write consistencygroup; fixed 1 unused variable warningdocs/development/build_execution_tracker.mddocs/development/master_development_brief.mdValidation
cf0889donfeat/post-write-consistencyNext slice
feat/publishing-ux-hardening— Stage 2B: Publishing workflow UX hardening. Refine success/failure wording, inline validation messaging, disabled/loading state consistency, and page-level vs row-level error separation.