Skip to content

Commit

Permalink
Fix error after first change to entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed May 10, 2024
1 parent 165eea1 commit 32f82fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed
- Fixed a bug where swapping the positions of new Neo blocks could cause a mixup of field layout elements and content loss
- Fixed an error that could occur when updating visible field layout elements after the first change to an entry

## 4.1.2 - 2024-04-09

Expand Down
6 changes: 3 additions & 3 deletions src/controllers/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function actionUpdateVisibleElements(): Response
$blocksData = $request->getRequiredBodyParam('blocks');
$fieldId = $request->getRequiredBodyParam('fieldId');
$ownerCanonicalId = $request->getRequiredBodyParam('ownerCanonicalId');
$ownerDraftId = $request->getRequiredBodyParam('ownerDraftId');
$ownerDraftId = $request->getBodyParam('ownerDraftId');
$isProvisionalDraft = $request->getRequiredBodyParam('isProvisionalDraft');
$siteId = $request->getRequiredBodyParam('siteId');
$sortOrder = $request->getRequiredBodyParam('sortOrder');
Expand All @@ -207,8 +207,8 @@ public function actionUpdateVisibleElements(): Response
$canonicalOwner = $elementsService->getElementById($ownerCanonicalId, null, $siteId);
$draftsQueryMethod = $isProvisionalDraft ? 'provisionalDrafts' : 'drafts';

// Get the blocks belonging to the current draft
$draft = $canonicalOwner::find()
// Get the blocks belonging to the current draft, or just use the canonical owner if no draft ID provided
$draft = $ownerDraftId === null ? $canonicalOwner : $canonicalOwner::find()
->{$draftsQueryMethod}()
->draftId($ownerDraftId)
->siteId($siteId)
Expand Down

0 comments on commit 32f82fa

Please sign in to comment.