-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Reduce redundancy in the RequestGraph's Request, Env, and Option nodes #9383
Conversation
d2d3614
to
d9cbb5f
Compare
05f988f
to
1943236
Compare
|}; | ||
|
||
export type RequestType = |
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.
💯
@@ -16,13 +16,15 @@ describe('RequestTracker', () => { | |||
let tracker = new RequestTracker({farm, options}); | |||
await tracker.runRequest({ | |||
id: 'abc', | |||
// $FlowFixMe[incompatible-call] |
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.
nit: It might be better to build a mock typecast so there's no any type created by the suppression, which would mean the test won't break if the types change
Something like:
async function mockRunRequest(
tracker: RequestTracker,
request: {...Request, type: Request.type | 'mock_request', ...},
opts?: ?RunRequestOpts,
): Promise<TResult> {
return tracker.runRequest(request, opts);
}
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.
Good call @JakeLane! Let me know what you think about how I mocked runRequest
(wasn't sure if that was the best way)
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.
65d93a9
to
fe4e0c5
Compare
91c015c
to
53fdf80
Compare
57cdf13
to
41f2ca7
Compare
↪️ Pull Request
Continued from #9360. This PR reduces redundancy in the RequestGraph's Request, Env, and Option nodes by getting rid of the
value
object in each of them, since these can be derived from their IDs. On a large app, this nets us a further ~7.1% reduction in the size of the serialized RequestGraph.💻 Examples
Request Nodes
Before:
After (Request Nodes still maintain a
request
type, but their subtypes can be distinguished viarequestType
):Env Nodes
Before:
After:
Option Nodes
Before:
After: