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

Error: toISOString is not a function #20

Open
Jonatthu opened this issue Mar 13, 2017 · 9 comments
Open

Error: toISOString is not a function #20

Jonatthu opened this issue Mar 13, 2017 · 9 comments

Comments

@Jonatthu
Copy link

This is happening with the latest extensions of chrome 2.14.2
But this was working very good before two versions ago, How can I downgrade to other versions to see which one was working good?

@zalmoxisus
Copy link
Owner

zalmoxisus commented Mar 13, 2017

That's not something introduced in the latest version of the extension. See for example zalmoxisus/redux-devtools-extension#315, which was happening in 2.14.0 as well.

This is happening because you're passing a React synthetic event directly to the action or a React component (which includes a synthetic event). A synthetic event is flushing the data (unless event.persist() is called).

The above exception happens because JSON.stringify is trying to call toISOString of a Date instance, which doesn't exists at the moment of serialization (being flushed by React).

Here are some solutions you can use. However, if you could share a repo to reproduce the issue, I'd try to find a way to overpass this exception from inside jsan.

@zalmoxisus
Copy link
Owner

You can try to install 2.13.1 by downloading and unzipping chrome.zip and then load the extension's folder.

@Jonatthu
Copy link
Author

I'm using the function this way too, is there a problem with this?
remotedev(this, {name: 'MAPWORDS STORE', global: true});
@zalmoxisus

@zalmoxisus
Copy link
Owner

It's not about the remotedev function, but about mobx actions and states being serialized. So, you have to make sure not to pass synthetic events anywhere, but only the needed part from them as described in Troubleshooting. If you could share a repro, I'd give more details.

@Jonatthu
Copy link
Author

@zalmoxisus with the decorator is failing, but the function on the constructor was working before
https://github.com/Jonatthu/angular-dependency-injection-failing/blob/master/src/app/store/store.ts#L18

@zalmoxisus
Copy link
Owner

zalmoxisus commented Mar 13, 2017

The decorator is ok, but that previous approach is not something we'd support. You should pass the class (to be extended) not the instance to remotedev.

So, instead of the decorator it would be:

class Store {
//...
}
export default remotedev(Store)

Could you please provide steps to reproduce the issue with that repo?

I see you're not using React, so my assumption about Synthetic events is wrong.

@Jonatthu
Copy link
Author

angular/angular-cli#4994 (comment)

Can we do something about it?

@zalmoxisus
Copy link
Owner

zalmoxisus commented Mar 14, 2017

Unfortunately, I don't know much about Angular and about how the providers and injections should work. I cloned the repo, ran ng serve and getting app works!. Not sure what I should look for.

In order to interact with the app (to change the data from the monitor side), we're extending the class here. This is the only thing that can interfere with that second decorator.

We are assuring not to do any operations when the extension is not enabled, so the class is not extended in that case.

@Jonatthu
Copy link
Author

@zalmoxisus
https://github.com/Jonatthu/angular-dependency-injection-failing/blob/master/src/app/store/store.ts#L15
This part of the code is not allowing the parameter "http" to be injected to the constructor, only when the extension is active

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