Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug when deleting sibling elements #17

Closed
wants to merge 1 commit into from
Closed

fix: bug when deleting sibling elements #17

wants to merge 1 commit into from

Conversation

Grafikart
Copy link

@Grafikart Grafikart commented Nov 17, 2019

Since deletions is controlled by "commitDeletion" , commitWork should not be triggered further in the fiber tree for old fibers.

Since deletions is controlled by "deletions" , commitWork should not be triggered further in the fiber tree for old fibers.
@Grafikart
Copy link
Author

This is an example of code that crashes without this PR

  function Counter () {
    const [n, increment] = useIncrement()
    return (
      <p id="b">
        Count: {n}
        <button onClick={increment}>Incrémenter</button>
      </p>
    )
  }

  function move () {
    const container = document.getElementById('root')
    Didact.render(<div>Hello</div>, container)
  }

  const element = <div id="a">
    <h1>Mon compteur</h1>
    <Counter />
    <button onClick={() => move()}>Move</button>
  </div>

  Didact.render(element, container)

@sschottler
Copy link

Since deletions is controlled by "deletions" , commitWork should not be triggered further in the fiber tree for old fibers.

This fixed my issue! I think you meant to say "deletions are controlled by commitDeletion"

@Grafikart
Copy link
Author

Grafikart commented Dec 1, 2019

Yeah I meant commitDeletion sorry, I fixed my original message.

@sschottler
Copy link

Also seems to fix #19

@zbzalex
Copy link

zbzalex commented Feb 1, 2023

} else if (vnode.effectTag === "DELETION") { commitDeletion(vnode, domParent) return }

This pull request was closed.
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.

3 participants