You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know exactly how the client managed it, but we have an Elemental based site in which multiple blocks have a sort-order of 1. This breaks the sorting logic as these blocks cannot be moved anywhere else than to the top anymore. I found related issues #849 / #934 / #931 but this one may be slightly different.
The cause seems to be the logic of limiting the reordering operation to blocks between 'current sort position' and 'new sort position' in DNADesign\Elemental\Services\ReorderElements::reorder, which runs an SQL query like: UPDATE "Element" SET "Sort" = "Element"."Sort" - 1 WHERE ("Element"."Sort" <= 5 AND "Element"."Sort" > 1) AND ("Element"."ParentID" = ?) 74, )>
In case of multiple blocks with an existing sort of 1, they're 'stuck' at one as they're not processed in the reordering (as that's limited to blocks with sorts higher than 1)... And each time you move a block with Sort of 1 to a different position, the block with Sort=2 will get reassigned a Sort of 1.
In one of the related issues, a proposed solution of re-applying a new Sort value to all blocks gets dismissed as sort of being a symptom fix instead of real fix. But there may be various situations in which duplicate Sort values occur which we can not all predict (and these may also be the result of intended actions, eg reassigning a block to a different Elemental Area).
As a more general fix, would it make sense to change the logic in DNADesign\Elemental\Services\ReorderElements::reorder from 'current sort -/+ 1' to an incrementing value? Eg assign a new value to Sort which always increments/decrements instead of relying on the current value +/- 1 (which persists duplicates once there are any). This is basically the solution proposed in #931 but then as a direct SQL query to prevent multiple writes.
This may be a bit less clever/precise than the current logic but any duplicate Sort values would automatically 'heal' and at least the result would match what the user intended.
The text was updated successfully, but these errors were encountered:
I don't know exactly how the client managed it, but we have an Elemental based site in which multiple blocks have a sort-order of
1
. This breaks the sorting logic as these blocks cannot be moved anywhere else than to the top anymore. I found related issues #849 / #934 / #931 but this one may be slightly different.The cause seems to be the logic of limiting the reordering operation to blocks between 'current sort position' and 'new sort position' in
DNADesign\Elemental\Services\ReorderElements::reorder
, which runs an SQL query like:UPDATE "Element" SET "Sort" = "Element"."Sort" - 1 WHERE ("Element"."Sort" <= 5 AND "Element"."Sort" > 1) AND ("Element"."ParentID" = ?) 74, )>
In case of multiple blocks with an existing sort of
1
, they're 'stuck' at one as they're not processed in the reordering (as that's limited to blocks with sorts higher than1
)... And each time you move a block with Sort of1
to a different position, the block with Sort=2 will get reassigned a Sort of1
.In one of the related issues, a proposed solution of re-applying a new Sort value to all blocks gets dismissed as sort of being a symptom fix instead of real fix. But there may be various situations in which duplicate Sort values occur which we can not all predict (and these may also be the result of intended actions, eg reassigning a block to a different Elemental Area).
As a more general fix, would it make sense to change the logic in
DNADesign\Elemental\Services\ReorderElements::reorder
from 'current sort -/+ 1' to an incrementing value? Eg assign a new value to Sort which always increments/decrements instead of relying on the current value +/- 1 (which persists duplicates once there are any). This is basically the solution proposed in #931 but then as a direct SQL query to prevent multiple writes.This may be a bit less clever/precise than the current logic but any duplicate Sort values would automatically 'heal' and at least the result would match what the user intended.
The text was updated successfully, but these errors were encountered: