-
Notifications
You must be signed in to change notification settings - Fork 73
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: add integration with Redux DevTools #289
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
76a9453
to
acaaeed
Compare
Can you please add some documentation on how to get this setup as a developer? |
698a175
to
c63c063
Compare
I just added some instructions to the I decided to differentiate between debugging setState and using Redux DevTools extension. Let me know what you think! 😄 |
Hey @pac-guerreiro we have a conflict now, can you please take a look? I'll review this tomorrow, got back from OOO today and had to prioritize other issues/reviews. |
|
||
First, install Redux DevTools through your favorite browser ([Edge](https://microsoftedge.microsoft.com/addons/detail/redux-devtools/nnkgneoiohoecpdiaponcejilbhhikei), [Chrome](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)) | ||
|
||
Then, you can enable this type of debugging by passing `enableDevTools: true` to `Onyx.init({...})`. |
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.
I kinda wonder if this should be enabled by default on dev?
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.
@AndrewGable I'm not sure if it won't be impactful on performance 😅
c63c063
to
b080b88
Compare
@PauloGasparSv I just resolved the conflict 😄 |
Sorry for the delay, I had time to check the changes here (so far lgtm) but didn't test this yet. Will test it using the extension tomorrow : ) |
No problem 😄 I just fixed the tests that were broken because of my changes! |
lib/DevTools.js
Outdated
@@ -0,0 +1,54 @@ | |||
import {connectViaExtension, extractState} from 'remotedev'; |
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.
Hey @pac-guerreiro I'm really curious on how you decided on using remotedev
! I'm relatively new to React/ReactNative so would love to know : D
I could only find this slack post you sent recently on this.
(btw, this is super cool)
(btw 2, had to shift focus but I'm still planning on testing today)
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.
Sorry for the late response, I'm glad you like this idea 😄 I hope it helps a lot of developers working on the app 😄
Well, at first I thought I could fork the repo for redux dev tools extension but then I found it was too complex to adapt it as it was for Onyx
, so after some digging and research I found remotedev
, which was made by the same guy behind redux dev tools extension, if I'm not mistaken. It basically provides an api to connect to redux dev tools or any other extension that supports remotedev
, so I gave it a shot and it worked 😄
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.
OOO starting tomorrow, so removing myself! |
@pac-guerreiro do you mind fixing the new conflicts we have? Bump @AndrewGable for a review : D |
cda6b1b
f687142
to
cda6b1b
Compare
It is done 😄 |
Hey @pac-guerreiro I think I may have found a bug in this line this time (didn't happen before, not sure why it happened this time): I think the initial I think this error prevented me from signing because after I reinstalled dependencies the error was gone and I could sign in as usual. Can you please take a look at that? |
This issue happens inside Honestly, I guess the whole callback passed to DevTools constructor can be discarded since this was meant to update the storage each time we time travel between actions in DevTools but it doesn't work correctly 😅 |
Oh I see, I didn't double check but does it return If that's the case then it doesn't even make sense to coalesce that value but maybe we can skip that logic that removes the keys in case
Really?? So we don't that need that bit of logic? Sorry for the confusion ahaha I'm trying to understand what we can do next here : ) |
Yeah, I think it has some trouble parsing slash tokens sometimes, maybe because the extension is sending some messages in a format that remotedev is not ready to interpret 😅
It could be useful for debugging purposes if a dev wants to go back in time and see the state changes in real-time, but since this logic is broken because either that undefined issue occurs or it does work but going back causes new events to get triggered and shown in the dev tools 😅 So yeah, if you think it's better, I can drop this logic and we just provide the ability to check state changes in real time 😄 |
That sounds awesome to me! @AndrewGable do you mind giving your opinion on this too? |
Bump @AndrewGable : ) |
Yes that sounds good 👍 |
Bump @pac-guerreiro :D |
@PauloGasparSv - hey, just to let you know that @pac-guerreiro is ooo till 25.08 |
Wasn't aware, thanks a lot @TomaszFrackowiak!!! |
83357ba
to
9139a1f
Compare
Sorry for not warning you about my vacation! I just removed the code that was causing problems and resolved conflicts 😄 |
Bump @AndrewGable |
feat: add ability to time travel between state changes fix: add missing registerAction for merge fix(DevTools): state updates not being synched between tabs docs(DevTools): add proper documentation
9139a1f
to
eb2ffc4
Compare
@AndrewGable it is solved now 😄 |
Revert "Merge pull request #289 from pac-guerreiro/feature/remotedev"
@pac-guerreiro - Can you address this issue in a PR then re-submit? Looks like this PR was reverted. |
@AndrewGable Hope I'm not late to the party but here's the new PR for this work - #438 I redone everything from scratch since some things got changed in Onyx during this period. Instead of relying on third party node modules, I decided to implement the logic to connect to the extension by myself after doing some research into Onyx will connect to Redux DevTools extension by default. Developers will only be able to use this functionality on web apps. |
Details
This PR adds the ability to use React Native Onyx with Redux DevTools to debug storage changes.
Features:
View
SET
,MULTISET
,MERGE
,REMOVE
andCLEAR
actions in DevTools: payload data corresponds to the data which was written into the storage;View state diffs when an action is selected;
View current state at the time an action was called;
Time travelling is not possible (yet)
Related Issues
None
Automated Tests
Not needed because this doesn't affect internal behaviour
Linked PRs
None