InfomediaLtd / angular2-redux-example

Example project for using pure Redux with Angular 2 and TypeScript
MIT License
71 stars 14 forks source link

Problem with Redux Chrome DevTools #4

Closed sebasgavi closed 8 years ago

sebasgavi commented 8 years ago

Hi,

I'm not able to use the chrome extension, it throws an error on AppStore instantiation EXCEPTION: Error during instantiation of AppStore! (MainMenuComponent -> AppStore). so I guess I'm not implementing it right

My appStoreFactory: const appStoreFactory = createAppStoreFactory({ gameReducer }, [window.devToolsExtension ? window.devToolsExtension() : f => f]); (don't know much about Middlewares, implementing Redux for the first time)

I saw you use that extension in a gif on another question, could you please show the right way to do so? (I think it would be great if you enable it in the demo so people can play arround)

Thanks!

rubyboy commented 8 years ago

@vagyriag are you using the createAppStoreFactory from https://github.com/InfomediaLtd/angular2-redux ? If you are then the dev tools is already built into it. Just call createAppStoreFactory(gameReducer) and that should work.

If that doesn't work, I suggest trying to clone this project and checking if the dev tools work for you on this project. This, to confirm if the problem is configuration or maybe something else related to the installation of the dev tools extension in Chrome.

BTW, here's another example project that uses angular2-redux with the dev tools. It's a bit simpler (single reducer, like in your case) so maybe you'll find it closer to what you're trying to do: https://github.com/InfomediaLtd/angular2-tutorial/tree/master/7-redux Check out how it instantiates the appStoreFactory in https://github.com/InfomediaLtd/angular2-tutorial/blob/master/7-redux/app/main.ts#L16 image

sebasgavi commented 8 years ago

Yeah, I'm using the createAppStoreFactory. I already cloned the project and review all the code (btw, thanks for the config files) but it doesn't work there either... the devtools works with other examples.

I'm going to take a look to that other example.

Thanks!

rubyboy commented 8 years ago

Any luck there? Let me know if you want me to take a look at your code (Github link) and check if it works for me.

sebasgavi commented 8 years ago

no luck... don't know what could be. I assume the devtool should work in your demo? it doen't work there, but in this (demo of the devtools)[http://zalmoxisus.github.io/redux-devtools-extension/examples/counter/] it works fine

I don't know what it is... the devtools config says it's injecting in all pages. could be something with this match in the app-store-factory.ts? const isDebug = window && window.location.href.match(/[?&]debug=([^&]+)\b/) && window["devToolsExtension"];

rubyboy commented 8 years ago

Actually, the deployed demo doesn't have the dev tools enabled.

Silly question: Do you have the debug query param in your URL? (?debug=true)

sebasgavi commented 8 years ago

well... this is embarrassing... that was the problem.

didn't know about that, maybe it could be clearer? thanks again!

rubyboy commented 8 years ago

No worries. I'll put a note in the angular2-redux repository about it :)

rubyboy commented 8 years ago

Documentation updated :) Thanks for bringing this up.

https://github.com/InfomediaLtd/angular2-redux image