Skip to content

Fix positioning bug when creating new nodes#288

Open
chillbram wants to merge 1 commit intofranzose:masterfrom
chillbram:fix-position-when-creating
Open

Fix positioning bug when creating new nodes#288
chillbram wants to merge 1 commit intofranzose:masterfrom
chillbram:fix-position-when-creating

Conversation

@chillbram
Copy link

When creating a new node with both a parent_id and position specified, the positioning is set incorrectly. The $latest-- subtraction, which ensures that the position value does not balloon should not run when creating a new node as now you do want to allow the position number to increase.

Example:

I'm creating N3 with the parent_id of N1 and a position of 1. The figure below is how it should turn out. In the saving step, Entity::getLatestPosition() correctly returns 1 (as the position of N2 is 0). However this is subtracted to 0 as the position column is "dirty" and we're "reparenting".

   N1
   |
|------|
N2    (N3)

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.

1 participant