-
Notifications
You must be signed in to change notification settings - Fork 30
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
withDevTools does not show Map type #104
Comments
@Diaaz, good point, let me check and expect an answer once v19 comes out |
@Diaaz, you can define now a mapper where you map to any structure you want. If that doesn't fix your problem let us know: https://ngrx-toolkit.angulararchitects.io/docs/with-devtools#withmapper |
@rainerhahnekamp Thanks for the update, but this does not really solve the problem. The idea of updateState is to help developers inspect the values of objects in a store (without needing to write mappers for all those instances). When the standard type 'Map' is used, the log shows an empty node and ignores the content. The record type is logged correctly, but the Map type is not. |
@Diaaz, you would have to write your own mapper function of course, but I think you want that devtools support the |
@Diaaz @rainerhahnekamp I don't think this is a bug. Redux DevTools does not serialize non-JSON objects like
|
@jdegand, thanks yes, I also don't think that Redux DevTools serialize these things. Otherwise it would work. If I'm not mistaken, there is no const Store = signalStore(
withState(initialState),
withDevtools(
'user',
withMapper((state) => // code to serialize Map in any way you want.
)
); |
This seems to be a common problem across many different JS state solutions. The serialize solution I posted is how it is done in Redux. See this Zustand issue. I would try to parse and stringify the state inside Check this redux-devtools issue as well. NGXS also has problems. |
Yeah, I mean one could build common serialization stuff into this extension. That's not a big deal, but on the other side, a Map should not end up in a signal in the first place. |
Yes, it will not work with change detection. |
Thanks for the info, I will remove Map from all my signal stores. |
Yes, @Diaaz, it is important that you also understand that If you have that code: const data = userStore.personMap();
data.set(1, // data for person); In this case the |
when using 'updateState(store, "setViewEntityConfig", { viewEntityConfig });' where viewEntityConfig is an object with a Map in it, the Redux tab in Chrome shows:
![image](https://private-user-images.githubusercontent.com/7457051/391031026-5d144ad1-6740-486f-805d-0001a20001b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NzM1NTAsIm5iZiI6MTczOTk3MzI1MCwicGF0aCI6Ii83NDU3MDUxLzM5MTAzMTAyNi01ZDE0NGFkMS02NzQwLTQ4NmYtODA1ZC0wMDAxYTIwMDAxYjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTlUMTM1NDEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWNlNWViZmM3ODkzMDZhN2JiYWVhMjAzYTM1ZjMyNWRlNDE3NDM1YzI3ZTQ5NDRjNjFhZjZhNGQxODkxMmU3MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.YFDtkeRZgaoI2hH1c8yWbK3_mA-uteyf4fTQBrBLIxg)
This is what console.log shows:
![image](https://private-user-images.githubusercontent.com/7457051/391030683-b7c1eb01-b7b6-478f-9e53-2583f707ad14.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NzM1NTAsIm5iZiI6MTczOTk3MzI1MCwicGF0aCI6Ii83NDU3MDUxLzM5MTAzMDY4My1iN2MxZWIwMS1iN2I2LTQ3OGYtOWU1My0yNTgzZjcwN2FkMTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTlUMTM1NDEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZGJjMGEwYTgzOGU4ZGIwYjdlN2Y2NTc0YjYzYzBmYTYyMmI5NDJmOWRlYzkzZDhmYTBiZDNlNmMwNDk5ZjRiNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.YRFFZtVU-8GGjIlcX70mVM_EpTizPOvHggKFJWQlGNg)
Would it be possible to show the entire objects in de Redux-tab?
Kind regards,
Jeroen.
The text was updated successfully, but these errors were encountered: