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
[relay-compiler] @preloadable Support #4515
Conversation
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.
Thank you for working on this!
@alunyov this would be ready to go from my side. I'd like to add tests, but it seems like there is no existing test setup for |
960a314
to
77fbdb1
Compare
@alunyov would you mind taking another look at this? It would be incredibly valuable for us to have this feature :) |
@tobias-tengler sorry for the delay. I'll try to get to this next week |
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.
Overall, a very clean PR! Thank you for adding this.
Can you add a test for this? I think we have a way to add integration tests now: https://github.com/facebook/relay/tree/main/compiler/crates/relay-compiler/tests/relay_compiler_integration
...lay-compiler/tests/relay_compiler_integration/fixtures/javascript_preloadable_query.expected
Outdated
Show resolved
Hide resolved
@alunyov Added an integration test for each language option and fixed the |
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 looks great!
@tobias-tengler lets fix these rust formatting issues, and I'll import this internally. |
@alunyov fixed :) It's weird that my editor doesn't format correctly. I'm using VS Code, rust-analyzer and I'm working from within the |
Do you have an idea why this fails? https://github.com/facebook/relay/actions/runs/7452983745/job/20277398152?pr=4515 |
Did you run |
Sorry about that... We have a weird internal rust configuration, that we somehow is trying to replicate in OSS. cc @captbaritone - were there any discussion with internal Rust team on how to properly setup OSS rust projects that needs to be synced internally? |
Oh f*** me 😂 I totally wrote them by hand, whoops. |
@alunyov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
} | ||
|
||
//- operations.json | ||
{} |
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.
@tobias-tengler somehow the query text is missing in the operations - this is maybe related to the way the integration test prints these files...
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.
12448e4
to
92e4125
Compare
@tobias-tengler you'll also need to update integration test setup, to include the default extra generator to the test config |
…piler integration tests
@alunyov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Can / should this support mutations? I've noticed mutations often add up to a large chunk of bundle sizes (sometimes due to including It's not quite the same flow as preloading queries, but a similar idea I think to prioritize the part needed to issue the request (and defer the part to process the response). It seems especially applicable since mutations are not used more often than they are used. |
This is based on an earlier implementation done by @tomgasson in #4110
Companion PR for
@types/relay-runtime
: DefinitelyTyped/DefinitelyTyped#68144An example application using this can be found here