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
[WIP] add a memory panel #1288
base: main
Are you sure you want to change the base?
[WIP] add a memory panel #1288
Conversation
resolvers: { | ||
Query: { | ||
memoryInternals(): Promise<MemoryInternals | undefined> { | ||
return rpc.request("getMemoryInternals"); | ||
}, | ||
}, | ||
}, |
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 don't know if this pattern is genius or incredibly stupid, but it might be very interesting in combination with pollInterval
and remove a lot of our orchestration complexities.
@jerelmiller do you have an opinion on this?
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 think this is totally fine! And agreed. The more I'm working with devtools, the more I think we can move some of the code in devtools.ts
over to the React application, This falls in line with my thinking there so I dig it.
Job #89: Bundle Size — 1.11MiB (+1.3%).Warning Bundle contains 5 duplicate packages – View duplicate packages Warning Bundle introduced one new package: rehackt – View changed packages Bundle metrics
Bundle size by type
View job #89 report View pr/memory-panel branch activity View project dashboard |
unsubscribers.add( | ||
createRPCBridge( | ||
createPortMessageAdapter(port), | ||
createWindowMessageAdapter(window) | ||
) | ||
); | ||
|
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.
Not 100% sure if this is the right place to create this bridge 😬
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 would make two changes here:
- Move the
createRPCBridge
call inside the theif (!connectedToPanel)
below. - Remove the
unsubscribers.add
call around this
The reasoning here is that we still want to allow messages to travel between the background port and the panel window even when the panel is hidden (e.g. the user navigated away by clicked the "Elements" tab). I can think of some cases like opening the Apollo tab, then quickly switching away from it, but still allowing the injected script to report back whether it found a client or not (which will eventually be an RPC call as well). If we unsubscribe the bridge, any message that gets sent while the panel is hidden will be dropped.
The if (!connectedToPanel)
should only ever execute the first time the panel is created, so we shouldn't have to worry about this script accidentally creating too many bridges.
No description provided.