Skip to content

Commit 4a0f480

Browse files
author
Flaviu Chelaru
committed
edges are not calculated properly - between selecting maxRight and actually using it, the tree changes too many times
1 parent f0caad9 commit 4a0f480

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Behavior.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ public function processUpdate(ModelInterface $model): void
200200
return;
201201
}
202202

203-
$maxRight = $model::maximum(['column' => self::$rightKey]);
204-
205203
// upgrade children of current node in the tree
206204
$query = 'UPDATE `' . $model->getSource() . '` SET ' .
207205
'`' . self::$depthDbColumn . '` = `' . self::$depthDbColumn . '` - 1, ' .
@@ -241,6 +239,7 @@ public function processUpdate(ModelInterface $model): void
241239
'id' => $model->readAttribute(self::$primaryKey),
242240
]);
243241

242+
$maxRight = $model::maximum(['column' => self::$rightKey]);
244243
// unset the parent - make the node a root
245244
if (!$parentModel) {
246245
$model->assign([

0 commit comments

Comments
 (0)