Skip to content
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

Update rescript relay fork #3

Merged
merged 348 commits into from
Aug 5, 2022
Merged
Changes from 1 commit
Commits
Show all changes
348 commits
Select commit Hold shift + click to select a range
2b82041
Move QueryResource tests into OSS
captbaritone May 31, 2022
f66305f
Move FragmentResources into our main test suite
captbaritone May 31, 2022
e4bec80
Move LiveResolvers test into OSS
captbaritone May 31, 2022
c9053e0
Move Client Edges to Client types tests
captbaritone May 31, 2022
aa6e13a
Remove many unused deps
zertosh Jun 1, 2022
2a9ee9f
Emit metadata for fragments w client edges
josephsavona Jun 1, 2022
773523d
Update Compiler Playground tests (#3927)
captbaritone Jun 1, 2022
13a1886
Demonstrate duplicate field definition bug
captbaritone Jun 1, 2022
7d4d133
Avoid creating duplicate field definitions
captbaritone Jun 1, 2022
271a162
Support CommonJS for @no_inline (#3923)
tbezman Jun 1, 2022
c263109
Optimize hooks based on client edge metadata
josephsavona Jun 1, 2022
5c8d47e
Enable dependency injection of hook implementations
davidmccabe Jun 1, 2022
f56cbdc
Example of the error when resolvers used with different arguments
alunyov Jun 2, 2022
36823ea
Example resolver without fragment used with different arguments in th…
alunyov Jun 2, 2022
6bb6887
Add LTI annotations to function params in xplat/js/RKJSModules/Librar…
pieterv Jun 2, 2022
43e21fe
Add LTI annotations to function params in xplat/js/RKJSModules/Librar…
pieterv Jun 2, 2022
235e0a7
Regression test for D36706346
captbaritone Jun 2, 2022
ba2f3d7
Add fixture tests for hover
captbaritone Jun 2, 2022
7984a45
Deploy 0.179.0 to xplat
evanyeung Jun 2, 2022
80a66c9
Support query variables in `@inline` fragments (#3933)
tbezman Jun 2, 2022
bc24c40
Enable enforce_local_inference_annotations in xplat/js/RKJSModules/Li…
pieterv Jun 2, 2022
c782836
Avoid throwing when fragmentRef is null in plural case
tyao1 Jun 2, 2022
8b484e1
autocargo
Jun 2, 2022
9556f2f
Persist explorer state in the URL/local storage (#3930)
captbaritone Jun 2, 2022
d84d4b1
third-party/rust: Update async-trait from 0.1.52 to 0.1.56
Jun 3, 2022
619e0e4
Move test resolvers into relay-runtime package
captbaritone Jun 3, 2022
82d0f0e
Avoid useMemo for fragment data except on plurals
josephsavona Jun 3, 2022
90b4226
fix lints in OperationExecutor
mroch Jun 3, 2022
20626f2
Make __typename selections within concrete linked fields have a strin…
rbalicki2 Jun 3, 2022
88632fd
Preserve implicit dependencies
captbaritone Jun 3, 2022
a429364
Fix config (#3937)
captbaritone Jun 3, 2022
b3db365
Summary:
alunyov Jun 6, 2022
97ea7b7
Generate resolver function types
alunyov Jun 6, 2022
17b694f
remove inline fragment wrapper on the __typename for the resolvers wi…
alunyov Jun 6, 2022
c6f78e4
Example test with fragment-less in Live Resolver
alunyov Jun 6, 2022
3befac0
Test: Live resolver with args and no fragment
alunyov Jun 6, 2022
383cbeb
Disallow console errors/warns in fetchQuery test
alunyov Jun 6, 2022
0edc913
Remove feature flag
rbalicki2 Jun 6, 2022
c92e4ef
Add PreloadedQuery import to render example (#3940)
scottilee Jun 6, 2022
bd656a7
Subscribe based on latest (missed) updates
josephsavona Jun 6, 2022
31b6767
Release provided variables feature (AKA: remove feature flag).
alunyov Jun 7, 2022
1244359
Support for client-only queries
alunyov Jun 7, 2022
f4b0658
Test with client-only queries
alunyov Jun 7, 2022
84bc04a
Use `__id` field in relay resolver instead of `__typename`
alunyov Jun 7, 2022
704e4f3
Generate client-only query types for client-only queries
alunyov Jun 7, 2022
42ae955
Fix flow error in ClientOnlyQueries-test in OSS
alunyov Jun 7, 2022
24adfda
Bump eventsource from 1.1.0 to 1.1.1 in /website (#3934)
dependabot[bot] Jun 7, 2022
5c3a5ef
Docs for v14
alunyov Jun 7, 2022
f855387
v14.0.0
alunyov Jun 7, 2022
17e80d0
Enable some ESLint rules which we use internally (#3944)
captbaritone Jun 7, 2022
e8c9ffe
fix(compiler): make LocalPersister include trailing newline (#3938)
wincent Jun 7, 2022
8f96330
Re-sync with internal repository (#3952)
facebook-github-bot Jun 7, 2022
6119236
Update Cargo.lock (#3951)
alunyov Jun 7, 2022
96ac34b
Validate rust fmt in GtiHub CI (#3950)
captbaritone Jun 7, 2022
eb5b319
Small refactoring in the `skip_unreachable_nodes` - store errors in t…
alunyov Jun 7, 2022
e5ffd24
Include platform and arch in the compiler error message
alunyov Jun 7, 2022
ef8c95d
Fix to always render w latest state
josephsavona Jun 7, 2022
baa2e6d
Unify Prettier config and enforce Prettier in GitHub CI (#3953)
captbaritone Jun 8, 2022
a52035d
Add a script that runs the compiler from Cargo without any config (#3…
captbaritone Jun 8, 2022
464c4d1
Use WeakMap for query caches
josephsavona Jun 9, 2022
ff10757
Flow: Ignore nested node_modules (#3955)
captbaritone Jun 9, 2022
31dff59
Document LSP
captbaritone Jun 9, 2022
7c2200f
VS Code Extension - update compiler SEMVER_RANGE
alunyov Jun 9, 2022
1a9d169
Provide a good VSCode setup for contributors (#3959)
captbaritone Jun 9, 2022
605f055
Support @live resolver with client edge and no fragment (#3942)
captbaritone Jun 9, 2022
3803801
Remove state / raw-state distinction
josephsavona Jun 9, 2022
56bcdcc
theoretical edge case for batched state changes
josephsavona Jun 9, 2022
8147d17
Resolvers without fragments don't have dependencies (#3954)
captbaritone Jun 9, 2022
b5c83d5
Revert D37005589: Resolvers without fragments don't have dependencies
Jun 9, 2022
2b9876f
Mark release
captbaritone Jun 9, 2022
c0f6bb7
Publish Relay VS Code extension from Github Actions (#3963)
alunyov Jun 9, 2022
a8811c0
Update docs now that validators are rarely required
rbalicki2 Jun 9, 2022
b3f6189
Use `yarn` in the vscode action for extension release (#3964)
alunyov Jun 9, 2022
0b1d43f
Set custom scalars values via typesafe updaters
alunyov Jun 9, 2022
7c2daeb
Back out "Revert D37005589: [relay][PR] Resolvers without fragments d…
captbaritone Jun 10, 2022
b651116
docs: Update search term in Relay for VSCode docs (#3962)
olerichter00 Jun 10, 2022
46b22f9
Remove note on Haste requirement for resolvers (#3967)
bigfootjon Jun 10, 2022
1b7e7b1
Add debugging guide for undersanding why fields might be null
captbaritone Jun 10, 2022
f1072fa
Deploy 0.180.0 to xplat
pieterv Jun 10, 2022
0d173d6
Improve name for Client Edge stripping transforms
captbaritone Jun 11, 2022
1450153
Add test with conflicting client fields
alunyov Jun 13, 2022
a86323f
Validate conflicting selections in client fields
alunyov Jun 13, 2022
8db002f
Support custom scalar arguments that are passed as literals
alunyov Jun 13, 2022
6b7c7b2
Adds language option to relay.config.js (#3973)
raghav-mylagary Jun 13, 2022
735c496
Correctly remove RefetchableFragment artifacts for ClientEdges in inc…
alunyov Jun 14, 2022
7d5cc34
Add support for resolvers without fragments
alunyov Jun 14, 2022
389216c
Skip null arguments before validating selection conflicts
alunyov Jun 14, 2022
ec1bed6
Add `langugage` to the v14 docs
alunyov Jun 14, 2022
b193cad
Demonstrate client edges getting swallowed
captbaritone Jun 14, 2022
2bdda86
Clarify fetchQuery subscription
davidmccabe Jun 15, 2022
d42bb7c
VSCode extension pathToRelay doesn't allow relative paths (#3969)
leoasis Jun 15, 2022
9990e6f
Disallow default values on resolver fields
alunyov Jun 15, 2022
511f041
Optimize validate_selection_conflict hashmaps
josephsavona Jun 15, 2022
6a60ba0
Cut minor release
captbaritone Jun 15, 2022
06d22fd
Prep useRefetchableFragment test for multiple versions
josephsavona Jun 15, 2022
c587c23
Use QueryResource, implement useRefetchableFragment
josephsavona Jun 15, 2022
b965299
useClientQuery hook
alunyov Jun 15, 2022
f8ff879
Upgrade clap to 3.1.18
brianc118 Jun 16, 2022
506fbde
Fix typo in code example (#3976)
randing89 Jun 16, 2022
3281299
switch from babel-eslint to hermes-eslint for flow code
bradzacher Jun 16, 2022
64d4dc1
non-FragmentResource version of usePaginationFragment
josephsavona Jun 16, 2022
4644a31
Fix prettier config in VSCode Extension (#3971)
tbezman Jun 16, 2022
92b2e8b
Ensure Client Edges Metadata inline fragments don't get merged in fla…
captbaritone Jun 16, 2022
dd54350
Injectable usePaginationFragment and useRefetchableFragment
davidmccabe Jun 17, 2022
72764d5
Fix typos in the required directive guide
tcopeland Jun 17, 2022
fa5a3ba
Explicitly enumerate unsupported ReaderNode types
captbaritone Jun 17, 2022
e54eb16
add exact_by_default=true to .flowconfig (#3980)
voideanvalue Jun 17, 2022
1a5e38e
Update Flow types for Jest (#3979)
captbaritone Jun 17, 2022
201438e
Deinjectify useLazyLoadQuery
davidmccabe Jun 18, 2022
6a9b0e5
Further Performance optimizations
Jun 20, 2022
a79f425
Import type for resolver function in client edges
alunyov Jun 20, 2022
43c4ed0
Generate LiveState<...> return type for live resolvers
alunyov Jun 20, 2022
b88a3c9
Revert D37188823: Multisect successfully blamed D37188823 for test or…
Jun 21, 2022
bd2e417
codemod away flow exact object type syntax (#3981)
voideanvalue Jun 21, 2022
bb4981a
extra suppression for www sync
josephsavona Jun 21, 2022
17bfd3f
Make artifact.path available to OperationPersister
Jun 21, 2022
c96f924
Deploy 0.180.1 to xplat
jbrown215 Jun 21, 2022
c9351d3
Back out **AND FIX** "Revert D37188823: Multisect successfully blamed…
Jun 21, 2022
c270194
Deinjectify usePreloadedQuery
davidmccabe Jun 21, 2022
f59648b
Fix typo in the example (#3982)
ddanielsantos Jun 21, 2022
5998146
Reformat fbsource
stepancheg Jun 22, 2022
534b66d
Fix docs for logs (#3988)
tbezman Jun 22, 2022
8adcfab
Find references of the Resolver field.
alunyov Jun 23, 2022
da757ca
Bump hyper from 0.14.9 to 0.14.12 in /compiler (#3978)
dependabot[bot] Jun 23, 2022
90ccda1
Support `@argumentDefinitions` in `@inline` fragments (#3935)
tbezman Jun 23, 2022
5f33c8a
Deploy Flow 0.181.0
mroch Jun 23, 2022
ee99ea4
ethers.rs
Jun 24, 2022
068608c
update rustfmt used by ci (#3994)
voideanvalue Jun 24, 2022
3968341
Handle suspense values in _readClientEdge
alunyov Jun 24, 2022
c2f0f96
Bump dashmap from 4.0.2 to 5.1.0 in /compiler (#3977)
dependabot[bot] Jun 25, 2022
bff5abb
Bump jsdom from 16.4.0 to 16.7.0 (#3992)
dependabot[bot] Jun 25, 2022
8935746
Update clap in third-party/rust
stepancheg Jun 26, 2022
bccbac1
Update rustfmt and reformat the repo back
stepancheg Jun 27, 2022
19b87b6
Bump crossbeam-utils from 0.8.5 to 0.8.8 in /compiler (#3949)
dependabot[bot] Jun 27, 2022
0d8e427
Remove redundant getStorageKey call in RelayReader
alunyov Jun 27, 2022
91251aa
update rustfmt toolchain version (#3997)
voideanvalue Jun 27, 2022
a740af3
update watchman-client version in relay and graphql_build_infra
Jun 28, 2022
4e78dd5
fix(website): Broken link on versions page (#3996)
luanvdw Jun 28, 2022
d94417b
Return empty array for empty array fragmentRef in useFragment
davidmccabe Jun 28, 2022
953cdce
Deploy Flow 0.181.2
mroch Jun 30, 2022
d4eae8d
Apply rustfmt
stepancheg Jul 1, 2022
df2c996
Apply rustfmt
stepancheg Jul 1, 2022
c730ab6
imports_granularity=Item
stepancheg Jul 1, 2022
be0e781
Add `this` annotations to Relay
pieterv Jul 6, 2022
89ece2e
Enable fragments to have transformed variable definitions
mjmahone Jul 6, 2022
bb6cd90
Update dependenices to support the latest Flow syntax
pieterv Jul 6, 2022
90c2ed6
Cleanup type for fragment args on @inline fragments
captbaritone Jul 6, 2022
3cfc85f
update clap to v3.2.8 in third-party/rust
emersonford Jul 6, 2022
055908f
Fix comment blocks (#4001)
tbezman Jul 7, 2022
8e25d86
Upgrade rust-analyzer to 2022-04-25 and lsp-types to 0.93 [rusty]
Wilfred Jul 7, 2022
7e6dbdd
Ensure only one implemntation on interface
captbaritone Jul 7, 2022
9a8d13e
Fix typo in @emails pragma
captbaritone Jul 7, 2022
c346ad7
Deploy 0.182.0 to xplat
evanyeung Jul 8, 2022
ab8e59f
Add test with client-edge and @required
alunyov Jul 8, 2022
d117221
Allow @required with client-edges fields
alunyov Jul 8, 2022
cefab9e
Support for @required and client-edges
alunyov Jul 8, 2022
78b8f9c
Only suspend on initial mount
davidmccabe Jul 11, 2022
cd1e9ae
Fix MutationHandlers on field with args
tyao1 Jul 11, 2022
ae5d94b
Support suspending live resolvers in the new React Cache implementati…
captbaritone Jul 11, 2022
4b67600
Update docusaurus
antonk52 Jul 12, 2022
02f61b8
Update compiler version in relay-bin
alunyov Jul 12, 2022
c4dbd26
Remove `.js` and `.ts` from require / import (#4002)
tbezman Jul 12, 2022
57f96a1
Improve error message when you mix up @live and non-live values.
captbaritone Jul 12, 2022
a4ce8b7
update Cargo.lock (#4008)
alunyov Jul 13, 2022
5c24750
bump clap version to 3.2.10
emersonford Jul 13, 2022
a5d67d6
Add resolvers to the dependency graph
alunyov Jul 13, 2022
f1bad70
Collect base resolver fragment ASTs
alunyov Jul 13, 2022
1de5c4f
Remove dependecy map for resolvers
alunyov Jul 13, 2022
17a2b07
Update relay test artifacts
alunyov Jul 13, 2022
9a3f726
Do not panic if we cannot serialize/deserialize watchman clock value
alunyov Jul 13, 2022
fa02805
Fixing typos - "filedName" should be "fieldName"
Jul 13, 2022
017ad5c
fix(doc): fixed typo in relay-resolvers (#4009)
giautm Jul 14, 2022
f663bc0
Update compiler config for tests (#4011)
alunyov Jul 14, 2022
def2ff2
Improvement and test for not suspending
davidmccabe Jul 14, 2022
00b8b5e
Codemod `{...null}` to `{}` in xplat/js
gkz Jul 15, 2022
caf92ce
Enable exact_empty_objects in Relay/oss/__github__/.flowconfig
gkz Jul 15, 2022
e08431e
Bump ansi-regex from 4.1.0 to 4.1.1 in /website (#4006)
dependabot[bot] Jul 15, 2022
430fad5
add copyright info in docusaurus config
voideanvalue Jul 15, 2022
d40d13f
Add a link to the compiler settings from the intro (#4010)
orta Jul 15, 2022
dec019d
update to ESLint v8
bradzacher Jul 16, 2022
fd9aaac
third-party/rust: update md-5, sha-1, sha2, digest to 0.10; hmac 0.12
jsgf Jul 19, 2022
48ef3e2
script to update yarn.lock for github
voideanvalue Jul 20, 2022
60e94d0
github ci node-versions: drop 12.x (#4017)
voideanvalue Jul 20, 2022
246b4f4
fix yarn lint for github checks (#4016)
voideanvalue Jul 20, 2022
4264743
regenerate yarn.lock for github
voideanvalue Jul 20, 2022
a121b33
Support fragment spreads on abstract types defined in client schema e…
captbaritone Jul 21, 2022
32b5f18
Deploy suppressions ahead of 0.183.0 to xplat
pieterv Jul 21, 2022
4041bb2
Deploy 0.183.0 to xplat
pieterv Jul 21, 2022
91af30d
Release resolved-env
SamChou19815 Jul 22, 2022
8cd1606
Daily `common/rust/cargo_from_buck/bin/autocargo`
Jul 22, 2022
e139ba1
Add bundlr-sdk to rust 3p crates
kaustavha Jul 22, 2022
df182d7
update flowconfig to ignore malformed_package_json in node modules (#…
voideanvalue Jul 22, 2022
a8e3665
automatic update for [email protected]
antonk52 Jul 22, 2022
404dd87
Add missing class annotations in xplat/js/RKJSModules/Libraries/Relay
pieterv Jul 22, 2022
3c94dec
Add a configurable import statement to ModuleImport
tyao1 Jul 22, 2022
4d92104
Use ModuleImport module providers in runtime
tyao1 Jul 25, 2022
df32ee1
Add docs for disallowing non-ID id fields
Jul 26, 2022
d0a3928
Disallow non-ID 'id' fields
Jul 26, 2022
6ec019c
minor fix for oss build scripts
mofeiZ Jul 26, 2022
eb44a34
v14.1.0
mofeiZ Jul 26, 2022
ecb03cd
Cut docs version v14.1.0
mofeiZ Jul 26, 2022
1d6070e
Remove ::{self}
stepancheg Jul 26, 2022
28cc8e6
Vendor tokio-rusqlite
scottcao Jul 26, 2022
a6eb291
Find field references for vscode extension
mofeiZ Jul 27, 2022
ae837d1
Downgrade VSCode version req
Jul 27, 2022
69972a9
Support client defined types which implement server interfaces
captbaritone Jul 27, 2022
8a139cf
Simplify some error message definitions
Jul 27, 2022
ba02e9d
Ensure stable order of imports in generated artifacts
captbaritone Jul 27, 2022
90fef92
Remove unnecessary prelude imports
zertosh Jul 27, 2022
a53b45c
Back out "Support client defined types which implement server interfa…
captbaritone Jul 27, 2022
ec62a80
T116895311 [bootcamp] Add location information to conditions
Jul 28, 2022
51b8522
Upgrade to Flow 0.183.1
mroch Jul 29, 2022
36279f8
Do not require virtual perist IDs for operations without text (client…
alunyov Jul 29, 2022
4d12002
Stop genereating `js` fields in query for 3D when local import is ena…
tyao1 Jul 29, 2022
a04397c
Back out "Cut docs version v14.1.0"
alunyov Jul 30, 2022
e11defa
Daily `common/rust/cargo_from_buck/bin/autocargo`
Jul 30, 2022
043a8a6
fix typo in typegen
alunyov Aug 1, 2022
729f726
Detect fragments on abstract client types used within client edge sel…
captbaritone Aug 1, 2022
3bf6406
Switch to use `GraphQL Syntax` as an extension dependency (#4032)
tbezman Aug 1, 2022
0530b34
Codemod away ::{self};
edward-shen Aug 1, 2022
4cea5dd
Add TRawResponse type to ClientQuery
Aug 1, 2022
4ba3fe8
Import fragment types in typegen in non-haste setups
alunyov Aug 2, 2022
eb6761d
Add missing class annotations in xplat/js/RKJSModules [suppressions]
pieterv Aug 2, 2022
5799146
fix moduleImportConfig support for single project configs
voideanvalue Aug 2, 2022
9f6952c
Optional Normalization in generate_artifacts
Aug 2, 2022
168a9fc
Client-Side Updatable Test
Aug 2, 2022
44ecca8
Exclude updatable queries from operation transforms pipeline
Aug 2, 2022
9582ec7
Support Suspension of ReactRelayQueryRenderer
sammy-SC Aug 3, 2022
196a57b
Fix bug where resolved promise was being reused
davidmccabe Aug 4, 2022
1c4e956
Upgrade to Flow 0.184.0
mroch Aug 4, 2022
17ae86c
Handle both `null` and `undefined` results from live resolver.
alunyov Aug 4, 2022
470a5fb
Add SDLSchema.get_unions() (#4036)
bayneri Aug 4, 2022
ff11ea8
Merge commit '0a30fd6b7d8263c738134fc6c07f160e2d3e07cc' into update-r…
zth Aug 4, 2022
6be90f7
Merge commit 'aa651a2ee782c538b4cd486e2570868e27294b5d' into update-r…
zth Aug 4, 2022
12e40d9
Merge commit 'e3b13901d9b66554ac6f48d09b3d8f02838d1bf3' into update-r…
zth Aug 4, 2022
1c2ed6b
Merge commit '0779fab9c4c0a39140f821cf3161453c16684c3d' into update-r…
zth Aug 4, 2022
28d72f3
Merge commit '868982b5b3dacb1f2c9601339084fc2d2f25c7a1' into update-r…
zth Aug 4, 2022
8299421
Merge commit '7e594c86ec85bbafa2c677337d8a2402a69742b0' into update-r…
zth Aug 4, 2022
323bb9a
Merge commit '22626b1d9ad8b549101d931caf14a136237ed65f' into update-r…
zth Aug 4, 2022
68ed136
fix custom scalars
zth Aug 4, 2022
d9dd605
Merge commit 'dd48057534949459ff34903397d960f046915a8f' into update-r…
zth Aug 4, 2022
6845125
Merge commit 'd23b8e04e7e9d0416d0193ba65db3d84d940fffc' into update-r…
zth Aug 4, 2022
9703bb5
Merge commit '271a1621ee6b913bc4488f294b7b0713dbee2a24' into update-r…
zth Aug 4, 2022
24bf886
Merge commit 'c7828365c6941519ded02e1c3bd61eddebb06290' into update-r…
zth Aug 4, 2022
b79b782
Merge commit 'ef8c95d3f87ffcf94ceb9d88d0446829766f07d7' into update-r…
zth Aug 4, 2022
0a6582c
Merge commit '9990e6f0bf790e0166e0db054fedee3b4ac22e0a' into update-r…
zth Aug 4, 2022
fc0186f
Merge commit 'ee99ea4bbbe9979eb52685b25b393ac93bf98489' into update-r…
zth Aug 4, 2022
c096e6c
Merge commit 'c4dbd26278fa7b2e54c6c8bd1feb6962be146f0c' into update-r…
zth Aug 4, 2022
e282210
Merge commit 'd0a39283d45854922119b779c4ac7014fd402d20' into update-r…
zth Aug 4, 2022
c5775c9
Merge commit '470a5fbc525f5dfc5a3a232f15d217420136b72c' into update-r…
zth Aug 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Exclude updatable queries from operation transforms pipeline
Summary:
Updatable queries do not get sent to the server. Consider usePrivacyIncidentFactGatheringContentStateQuery.graphql.js. The generated artifact only includes fragment and kind fields, i.e. no operation and no metadata. As a consequence, all of the work that we do to updatable queries in the `apply_operation_transforms`, `apply_normalization_transforms`, and `apply_operation_text_transforms` pipelines in apply_transforms.rs:

* is useless, since the results aren't used
* are actively harmful, in that the transforms in this pipeline enforce certain invariants that make no sense. e.g. updatable queries with only client only fields are disallowed — but that is in fact fine!

This change modifies the underpinnings to properly skip client-side-only `updatable` Queries.  The core problem of erroring out remains, since other logic causes empty queries to panic.

Reviewed By: rbalicki2

Differential Revision: D38132333

fbshipit-source-id: f1dea8f449ac9d5d289edaadcbdad18e1ee27987
  • Loading branch information
Russ West authored and facebook-github-bot committed Aug 2, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 44ecca88adda541610858d05b8b3a3abe2d2fa8a
Original file line number Diff line number Diff line change
@@ -111,12 +111,6 @@ pub fn generate_artifacts(
source_hash,
source_file,
)
} else if normalization.directives.named(*UPDATABLE_DIRECTIVE).is_some() {
// This weird structuring here is to preserve the order`
// of operations/fallbacks in the face of an "Optional" normalizaiton
// Right now, normalization will still be there, so we need this branch
// in a coming commit we will no longer generate the normalization AST for
// updatable queries and the "dangling if" below will become an "else if"
} else {
let source_hash = source_hashes
.get(&normalization.name.item)
@@ -131,9 +125,7 @@ pub fn generate_artifacts(
normalization.name.location.source_location(),
)
}
}

if let Some(reader) = operations.reader {
} else if let Some(reader) = operations.reader {
// We don't have a normalization AST, but we do have a reader.
// Therefore this must be an updatable query in order to continue.
if reader
5 changes: 5 additions & 0 deletions compiler/crates/relay-transforms/src/apply_transforms.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ use crate::assignable_fragment_spread::replace_updatable_fragment_spreads;
use crate::client_extensions_abstract_types::client_extensions_abstract_types;
use crate::disallow_non_node_id_fields;
use crate::match_::hash_supported_argument;
use crate::skip_updatable_queries::skip_updatable_queries;
use common::sync::try_join;
use common::DiagnosticsResult;
use common::PerfLogEvent;
@@ -308,6 +309,10 @@ fn apply_operation_transforms(
None,
)?;

program = log_event.time("skip_updatable_queries", || {
skip_updatable_queries(&program)
});

program = log_event.time("client_edges", || {
client_edges(&program, &project_config.schema_config)
})?;
1 change: 1 addition & 0 deletions compiler/crates/relay-transforms/src/lib.rs
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ mod skip_null_arguments_transform;
mod skip_redundant_nodes;
mod skip_split_operation;
mod skip_unreachable_node;
mod skip_updatable_queries;
mod sort_selections;
mod test_operation_metadata;
mod transform_connections;
52 changes: 52 additions & 0 deletions compiler/crates/relay-transforms/src/skip_updatable_queries.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::UPDATABLE_DIRECTIVE;
use common::Named;
use graphql_ir::OperationDefinition;
use graphql_ir::Program;
use graphql_ir::Transformed;
use graphql_ir::Transformer;

pub fn skip_updatable_queries(program: &Program) -> Program {
let mut transform = SkipUpdatableQueries::new(program);
let transformed = transform.transform_program(program);

transformed.replace_or_else(|| program.clone())
}

#[allow(dead_code)]
struct SkipUpdatableQueries<'s> {
program: &'s Program,
}

impl<'s> SkipUpdatableQueries<'s> {
fn new(program: &'s Program) -> Self {
Self { program }
}
}

impl<'s> Transformer for SkipUpdatableQueries<'s> {
const NAME: &'static str = "SkipUpdatableQueriesTransform";
const VISIT_ARGUMENTS: bool = false;
const VISIT_DIRECTIVES: bool = true;

fn transform_operation(
&mut self,
operation: &OperationDefinition,
) -> Transformed<OperationDefinition> {
if operation
.directives
.iter()
.any(|directive| directive.name() == *UPDATABLE_DIRECTIVE)
{
Transformed::Delete
} else {
Transformed::Keep
}
}
}