Skip to content

Consider removing the RouterStateSnapshot from router-store state #104

@shlomiassaf

Description

@shlomiassaf

Hi,

Using v4 I saw the the router state that comes in @ngrx/router-store has a state property that holds a reference to RouterStateSnapshot from @angular/router.

I'm not sure why the state needs to hold this object but it causes some issues.

  • In Performance Issues with Dev Tools + Router-Store #97 we can see a performance issue, this is probably due to the RouterStateSnapshot object, pretty sure about that... the redux dev tool try to render it and its a huge object when rendering deep.

  • The store can not be frozen.

The RouterStateSnapshot hold reference to a lot of objects... components, router tree's and what not. A lot of them change internally, i.e. get's mutated which makes the store mutable.

This means using a library like ngrx-store-freeze in development mode is not possible since deep freezing the store (state) will result in exceptions all over since deep objects in RouterStateSnapshot are expected to be mutable.

In general the store should be light, holding POCOs only.

cc @vsavkin, thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions