-
Notifications
You must be signed in to change notification settings - Fork 133
[DRAFT] Initial Redux DevTools integration POC #6601
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
c42fd07 to
194b4ab
Compare
The @redux-devtools/ui `<Editor>` component imports CSS directly, so Next is erroring. I've temporarily hand-edited my code locally, but this is just a hack workaround that needs to be fixed. On the bright side... rendering this component shows the whole Redux DevTools UI immediately! So that's great.
194b4ab to
0a7117c
Compare
✅ QA Wolf - Deploy PR
✅ 10 passed |
Previously, all annotations were fetched in `actions/reactDevTools`. We can only have one `ThreadFront.getAnnotations()` call, as `socket.ts` throws errors if you try to add another subscription. That logic was kicked off from `devtools.ts` as part of the initial setup sequence. But, that meant that annotations were coming in even before the rest of the React component tree mounts. Our React annotations are kept in the Redux store (hah!), but since Redux actions data can be _very_ large, we don't want to keep those in our own app's Redux store. The simplest option is adding a context provider component whose sole job is to keep the Redux annotations in state. To make things more complicated, the entire "DevTools" panel will unmount if you switch over to the "Viewer" tab. So, we can't just store Redux annotations down low in the component tree. After discussion with Brian Vaughn, I've addressed these issues by refactoring how we handle annotations: - There is now a `<ReduxAnnotationsProvider>` component that is rendered in the `<Body>` component and wrapped around both panels - That component is responsible for running the `getAnnotations()` subscription request. Since React's "Strict Effects" can cause effects to run twice in dev, we have to use a ref flag to make sure it only runs once. - It still dispatches all the React-specific annotations to the Redux store, same as before. - But, Redux-specific annotations are pre-processed to be in the form that we need, added to its own state, and passed down via a React context provider. Additionally, I've done some "productionization" of how the Redux DevTools tab gets loaded: - `<SecondaryToolbox>` reads the annotations list and only show the "Redux" tab if there are Redux annotations available - The `<ReduxDevToolsPanel>` component lazy-imports the actual `@redux-devtools/app` lib, so that we don't pay that bundle cost up front - The "reload actions into the DevTools store" code uses `batch()` to both minimize re-renders and avoid a data inconsistency crash that I was seeing
| return async dispatch => { | ||
| dispatch({ type: "set_protocol_fail" }); | ||
| }; | ||
| export function setProtocolCheckFailed(): SetProtocolCheckFailedAction { |
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.
💬 This action creator really didn't need to be a thunk anyway, since it's just dispatching a single basic action.
|
Status update:
First instance - a single Jotai "count" atom: Second instance - a "combined atoms" view: |
2aa9552 to
c60fbdc
Compare
|
I've updated this to keep the RDT theme in sync with the Replay app theme. Also tried passing down some flags to mark all of the RDT "features" as disabled, in the hopes that its UI would turn off buttons like "Jump" and "Skip", but doesn't seem to be doing what I want. That said, I think this is basically working at a v1 level at this point. Caveats:
|
jasonLaster
left a comment
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.
🚀












This PR:
@redux-devtools/apppackage, which has the prebuilt Redux DevTools UI components and logicnext-global-cssto work around Next throwing errors due to the RDT<Editor>component importing CSS from withinnode_modulesStatus
Totally a draft POC and absolutely not ready to ship in any way :)
At the moment, looks like a bunch of the supporting code I copy-pasted from the RDT "extension app" codebase is not compiling because it's missing other pieces. Not surprising! I will fix that stuff up on Monday so this at least builds clean.
Things that this needs for minimum productionization:
This is also entirely dependent on the FF content script changes sitting over in replayio/gecko-dev#831 - you've got to use an FF build with those to make the recording, which also means you can't even try this PR out because our prod backend doesn't recognize this FF build! We may need to just go merge in those changes and release a new FF build first to unblock the chicken/egg issue here.
Preview
Since you can't actually see or try this out atm, here's a Loom showing it off:
https://www.loom.com/share/738c236b13cf41fb902335d30c085edb