-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(store-devtools): export private Redux Devtools Extension injection token #3338
Conversation
✔️ Deploy Preview for ngrx-io canceled. 🔨 Explore the source changes: f36d865 🔍 Inspect the deploy log: https://app.netlify.com/sites/ngrx-io/deploys/6227a8e2c613de0007ccb610 |
Thanks @edusperoni. I don't see a reason why we need the symbol in front of the export if it's going to be part of the public API at this point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also provide some more context about the use case and what you would do on your end? I'm asking because this could also become a part of the NgRx project or it could be added to the docs.
Thanks for taking a look at this! I thought about adding the symbol so it would be easier to make it an exported private API, which means it could break at any point without notice in case of refactoring or changes in the devtools protocol, but I can remove the symbol no problem. In my case, I'm writing a plugin for NativeScript that will allow us to use remote devtools with NgRx directly on the phone. Since we don't have a window object, the currect way of grabbing the extension won't work, so I'm creating a module that provides that token and implements all the required functions from the extension and uses native websockets to communicate with the computer running remote devtools. In sum, this allows us to be more flexible when dealing with the devtools extension. Other frameworks may also benefit. Ionic seems to have a window object, so it's less of a problem (https://medium.com/nextfaze/remote-debugging-ngrx-store-with-ionic-74e367316193). And the reason we can't just introduce the window object in NativeScript is because many libraries check for a window object to detect if they're running on a browser or not, so it could have unintended side-effects. |
…on token The injection token REDUX_DEVTOOLS_EXTENSION is currently private and unable to be overriden by any means. This change allows for custom implementations of the devtools extension interface on platforms that are not browser
27fd838
to
f36d865
Compare
Thanks @edusperoni! If you have a blog post or guide to link to for setting up the remote devtools feel free to share it |
@brandonroberts I'll have more to share in the coming weeks in terms of blog posts, but If you want to take a peek, I'm developing the plugin here https://github.com/valor-software/nativescript-plugins/tree/feat/nativescript-ngrx-devtools/packages/nativescript-ngrx-devtools and it should be released soon. |
Hey guys! Sorry, I forgot to post the blog link here once it was published. If you want to read more about how we're using it in NativeScript with our own custom "extension", here's the blog post: https://valor-software.com/blog/Debugging_NgRx_in_NativeScript_with_Redux_DevTools |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
REDUX_DEVTOOLS_EXTENSION is private and we're unable to provide a custom interface implementation in platforms where window is not defined.
What is the new behavior?
We export
REDUX_DEVTOOLS_EXTENSION
asɵREDUX_DEVTOOLS_EXTENSION
allowing for custom implementations of the extension interfaceDoes this PR introduce a breaking change?
Other information
This change is needed to be able to debug ngrx using remote devtools under a
@nativescript/angular
application.