Skip to content

Prevent stale saves from restoring deleted repeater items - #381

Open
PercolatingStudio wants to merge 2 commits into
mainfrom
codex/issue-347-deleted-repeater-item
Open

PercolatingStudio wants to merge 2 commits into
mainfrom
codex/issue-347-deleted-repeater-item

Conversation

@PercolatingStudio

@PercolatingStudio PercolatingStudio commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Fixes #347.

Reproduction on the published 3.2.5 ZIP

On PrestaShop 9.1.4, create a FAQ block with two questions and open the same editor in two tabs. Select a question in the second tab. Delete it in the first tab and wait for the deletion to finish. Save from the second tab: the stale request succeeds and the deleted question returns after reloading. Waiting for the normal single-tab refresh already clears the selection; the second-tab test demonstrates the remaining defect on current main.

Fix

The repeater add action already persists new items before editing, so the update action now rejects a missing key without saving. The editor shows a message and refreshes the block selection if the response still applies to the current item and shop/language/zone. Normal saves still update existing keys. This change does not add transactional locking for truly simultaneous writes or change how keys are assigned.

Thanks to @Daaaaad for the detailed report.

Validation

  • Regression test exercises the actual AJAX action with a deleted key, invalid stored state, and an existing key. It fails before the fix and passes after it; it is wired into the release smoke suite.
  • Built the exact installable candidate ZIP with the normal builder (SHA-256 b47f0eba1d309d1fcf6aca344bba9de120f24e248bb49601742b6d20e36ecea5). Package/manifest checks, installations, and smoke tests pass on PrestaShop 8.2.7/PHP 8.1.33 and 9.1.4/PHP 8.5.0.
  • Browser-tested both shops: stale Save is rejected, the deleted question stays absent on reload, the other question remains, and a newly added question saves and survives reopening the editor.
  • Replaced the published 3.2.5 package with this exact ZIP in the existing disposable PS9.1 shop using the native ZIP handler. Stored block rows (including config and repeater data) and hook registrations had identical hashes before and after replacement, and the browser regression passed again. No schema change or version bump.
  • All 40 Node tests, PHP and shell syntax checks, and git diff --check pass.

No merge or release requested by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleted repeater item comes back after clicking Save

1 participant