[Request] Support generating $Parameters files in OSS compiler
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
While working on using Persisted Queries and Entrypoints to shrink network traffic / bundle sizes, I noticed a few key pieces of information in the web docs / JSDocs.
From https://relay.dev/docs/api-reference/use-entrypoint-loader/ :
> When the loadEntryPoint callback is called, each of an EntryPoint's associated queries (if it has any) will load their query data and query AST. Once both the query AST and the data are available, the data will be written to the store.
And from EntryPointTypes.d.ts on `ThinQueryParams.parameters`:
> NOTE: For now, since OSS relay-compiler doesnt support generating the $Parameters file, you must give the query wou would have given to usePreloadedQuery
This seems to answer a problem I was having around actually getting the AST deferred (as opposed to just the query text, which is proportional to AST size). It doesn't seem like this would require a ton of work on the compiler; could we get OSS support for this?
(Started as a discussion at https://discord.com/channels/625400653321076807/1176927740457398402 but I think its a feature request Issue now)
I think this could also be used to defer Mutations in a much better way (atm it's very tedious, since the built-in useMutation hook only really supports having the full AST up front; ideally we can fire the mutation without needing the AST and load it deferred, since mutations are mostly rarely occurring but large to the bundle size [if they need to refetch much of the page and thus have a complicated query])
Contributor guide
Assessment
This issue has not been assessed yet.