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

Custom RouterStateSerializer is called with both the original and the custom serialized version #286

Closed
DorianGrey opened this issue Aug 17, 2017 · 1 comment

Comments

@DorianGrey
Copy link

DorianGrey commented Aug 17, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

What is the current behavior?

I've just upgraded ngrx-router-store to 4.0.3 to be able to provide a custom RouterStateSerializer to get both the dev-tools and ngrx-store-freeze working again. While debugging, I've recognized that this serializer is not only called with the router snapshot, but with the serialized version it generated before as well.
I'm not sure if this is a bug w.r.t. the typings (i.e. it should be RouterStateSnapshot | T instead of just RouterStateSnapshot) or a technical issue.
Here is my current implementation, including a workaround to simply return the casted input instead of creating new data.

Expected behavior:

I would expect that either:

  • The typings reflect that the value provided to serialize may be the custom state version.
  • The serializer will never be called with the custom serialized version.

Minimal reproduction of the problem with instructions:

Minimal version: http://plnkr.co/edit/hlQKrHTDTqOrGasMkO4H
Just switch between the routes - two calls will be listed for each switch, one for the original snapshot and one for the serialized version. Calls are printed with console.warn.

Version of affected browser(s),operating system(s), npm, node and ngrx:

  • OS: Ubuntu 16.04
  • node: 6.11.1
  • npm: 5.3.0 / yarn 0.27.5
  • ngrx: 4.0.3

Other information:

./.

@brandonroberts
Copy link
Member

That is a bug, fix is here #287

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

No branches or pull requests

2 participants