Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

componentWillUnmount is not being called #1

@jankuca

Description

@jankuca

The componentWillUnmount lifecycle method is not being called when a renderer is reused to render a component of a different type (which results in a new component instance being created and mounted).

Introduced by f3090d5

const renderer = reactTestRender.createRenderer(ComponentA)
renderer.render()
renderer._Component = ComponentB
renderer.render()
// ComponentA#componentWillUnmount is not called.

This is why the component type cannot be swapped for a single renderer.

The raw ReactShallowRenderer from ReactTestUtils does not have this issue but it on the other hand does not call componentDidMount and componentDidUpdate. The correct tool for the tested situation has to be chosen for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions