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

Cannot import saved store state using devtools package #3636

Closed
1 of 2 tasks
MikeDabrowski opened this issue Oct 28, 2022 · 6 comments · Fixed by #3855
Closed
1 of 2 tasks

Cannot import saved store state using devtools package #3636

MikeDabrowski opened this issue Oct 28, 2022 · 6 comments · Fixed by #3855

Comments

@MikeDabrowski
Copy link

MikeDabrowski commented Oct 28, 2022

Which @ngrx/* package(s) are the source of the bug?

store-devtools

Minimal reproduction of the bug/regression with instructions

Using chrome redux dev tools, export the state to .json and import it again.

image

Minimal reproduction of the bug/regression with instructions

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

+-- @ngrx/effects@14.3.2
+-- @ngrx/entity@14.3.2
+-- @ngrx/router-store@14.3.2
+-- @ngrx/schematics@14.3.2
+-- @ngrx/store-devtools@14.3.2
+-- @ngrx/store@14.3.2

Other information

I think the problem is in the following line:

// Completely replace everything.
({
monitorState,
actionsById,
nextActionId,
stagedActionIds,
skippedActionIds,
committedState,
currentStateIndex,
computedStates,
isLocked,
isPaused,
} = liftedAction.nextLiftedState);

The nextLiftedState has the store structure and therefore does not contain all those 'meta' properties. This results in the error Cannot read properties of undefined (reading 'length')

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@timdeschryver
Copy link
Member

I'm closing this because it has no reproduction.
Feel free to reopen/create a new issue with a reproduction.

@MikeDabrowski
Copy link
Author

MikeDabrowski commented Apr 18, 2023

Happens everywhere I could check, so I didn't bother with specific repro.

it has no reproduction

So here you go: https://stackblitz.com/edit/angular-urqqk2?file=src/main.ts

Latest angular and ngrx. You will need to:

  1. have chrome redux dev tools installed
  2. go to the page above
  3. open dev tools and select proper store instance
  4. save the state to file
  5. load saved state from file
  6. see console with the same error

image
image
image

@timdeschryver
So kindly please, reopen

@timdeschryver timdeschryver reopened this Apr 19, 2023
@timdeschryver
Copy link
Member

Thanks @MikeDabrowski

@timdeschryver
Copy link
Member

This should work if you set the value of the import feature to 'import'.

@MikeDabrowski
Copy link
Author

image

@timdeschryver
Copy link
Member

My bad, I meant 'custom' @MikeDabrowski

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants