Skip to content

Discuss desired behavior of rerender #365

Closed
@shaman-apprentice

Description

@shaman-apprentice

Current behavior of rerender

It destroys old component and creates a new one from scratch with given properties.

My thoughts on it

  • Name rerender does not suggest to me, that component is created from scratch nor old one is destroyed.
  • Angular-testing-library should behave similar to react-testing-library. React's version of rerender does keep existing instance, meaning constructor of class and componentDidMount will not be called. render and componentDidUpdate will get called. Therefore I think rerender should not create the component from scratch but call ngOnChanges with simpleChange parameter containing previous values. Not passed in properties should be removed.
  • rerender seems to update props instead of replacing them #252 should work with rerender

When the component in rerender is not created from scratch, I think change is not useful anymore. All properties are controlled from outside. So we can pass in all properties we want to keep in rerender unmodified again. I guess that's why React's API doesn't have an equivalent of change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions