Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
Fix: call willSetParent earlier in case of append
Browse files Browse the repository at this point in the history
  • Loading branch information
raquo committed Apr 13, 2018
1 parent bbf4601 commit cec6977
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ trait ParentNode[N, +Ref <: BaseRef, BaseRef] extends Node[N, Ref, BaseRef] { th

/** @return Whether child was successfully appended */
def appendChild(child: BaseChildNode)(implicit treeApi: TreeApi[N, BaseRef]): Boolean = {
val nextParent = Some(this)
child.willSetParent(nextParent)

// 1. Update DOM
val appended = treeApi.appendChild(parent = this, child = child)
if (appended) {
val nextParent = Some(this)
child.willSetParent(nextParent)

// 2. Update this node
if (_maybeChildren.isEmpty) {
Expand Down

0 comments on commit cec6977

Please sign in to comment.