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

Avoid putting remote objects in the store #33

Merged
merged 1 commit into from
Nov 10, 2016

Conversation

CharlieHess
Copy link
Collaborator

@CharlieHess CharlieHess commented Nov 10, 2016

When getState is called from the renderer, what it's actually doing is creating an object in the main process. When we iterate that object for cloneDeep, each property look-up translates to an ipc.sendSync (this is similar to the situation in electron/electron#3856). We can avoid this whole rigmarole if we just use a primitive type, so instead, we'll stringify it.

This does add the requirement that everything you put in the store must be serializable (reasonable IMO). If you stored something like an Error or a RegExp this would break down.

@samiskin
Copy link
Owner

Lgtm!

@samiskin
Copy link
Owner

Though I'm not sure about the "everything you put in the store must be serializable", as theres currently actually an issue regarding that #32

@samiskin
Copy link
Owner

samiskin commented Nov 10, 2016

I'm not sure if there's a way around that though, and I think thats currently a problem anyway. The only thing I can think of would be to have the initial state also have to be filtered, but then that poses the problem of anything not passing the filter being undefined at the beginning instead of the initial value.

I'll leave the decision of whether to look into that to you by leaving the merging to you 👍

@CharlieHess
Copy link
Collaborator Author

@samiskin yeah I'm OK with it as it doesn't regress existing behavior, just makes it more explicit.

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

Successfully merging this pull request may close these issues.

2 participants