-
Notifications
You must be signed in to change notification settings - Fork 46
FHL: Make Relay quack like Apollo #214
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
Draft
alloy
wants to merge
190
commits into
main
Choose a base branch
from
alloy/relay-apollo-duct-tape
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
190 commits
Select commit
Hold shift + click to select a range
49707b7
[relay-apollo-duct-tape] Initial import
alloy 5b960b5
[relay-apollo-duct-tape] Working query/fragment reading/writing
alloy c76be43
[package] Use latest apollo in workspace root
alloy 8d97348
[patches] Make apollo cache interface use relay IR
alloy c30cd6a
[relay-duct-tape] Start implementing proper interface
alloy aaed906
[relay-duct-tape] Implement read/write
alloy fa42afe
Outputting IR
freiksenet a8d00dd
[relay-duct-tape] Implement Cache.watch
alloy ba4803a
Naming
alloy a872866
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
freiksenet 2c39cfc
MVC wIP
freiksenet caefbb0
Minor stuff
alloy cc87f1e
[relay-duct-tape] Skip environment for store writing
alloy 484fbd3
[relay-duct-tape] Use store more directly, rather than through enviro…
alloy 27d84d6
[relay-duct-tape] Implement batching
alloy 8db60ca
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
alloy 24ead2a
[relay-duct-tape] Implement Cache.diff
alloy f32a62a
Cleanup
alloy ca083ba
[relay-duct-tape] Implement optimistic writing/reading
alloy 63c6c42
[relay-duct-tape] Implement serialization
alloy 472f37a
Cleanup
alloy 999f312
Cleanup
alloy 68632d1
[relay-duct-tape] Revert optimistic transaction updates
alloy 09a58f3
[relay-duct-tape] Rename to RelayApolloCache
alloy 4bedd72
Cleanup
alloy 8c77ea9
[relay-duct-tape] Handle partial data
alloy a785413
[relay-duct-tape] List big TODOs
alloy 810985a
Sort of working
freiksenet 13c499c
Hackity hack
freiksenet e08ed9c
Generating flattened
freiksenet d2f38e9
[relay-duct-tape] Support type-policies key-fields
alloy 5dbf1a7
[relay-duct-tape] Use DocumentNode.__relay
alloy dd41ea0
[relay-duct-tape/example] Fix cache initialization
alloy cd6092b
[relay-duct-tape/example] Start with some data
alloy e2c4ca6
[relay-duct-tape/example] Alternative link method
alloy 13f4057
[relay-duct-tape] Package cleanup
alloy 507ad98
[relay-duct-tape] Prep for release
alloy 9d6ee86
[ci] Prep for relay-duct-tape release
alloy ddd4f92
Change files
alloy 1a6b087
Make TS checking green
alloy cb25ca8
More type faffing
alloy fc2ecee
More TS fixes
alloy 8ca3769
More TS faffing
alloy e0c831b
More TS fixes
alloy b448dfb
[package] sync
alloy a4cc859
applying package updates
gql-svc 6b78d25
Fix package
freiksenet bc7de70
Change files
freiksenet 6474938
applying package updates
gql-svc 5fa4371
TODO
freiksenet 79d89d2
[example/relay-duct-tape] Fixes
alloy 5fea593
[example/relay-duct-tape] Make mutation/subscription work
alloy ea4cd39
[example/relay-duct-tape] Add mutations and subscriptions
alloy d6a40d5
[relay-duct-tape] Add mutation integratio tests
alloy e95e79b
[relay-duct-tape] Add subscription integration tests
alloy 75b1e07
[relay-duct-tape] Add read memoization
alloy f248258
Change files
alloy 0b70d96
applying package updates
gql-svc 6ae873a
Start lazy generating IR
alloy a5ac058
Working version
alloy a2d7ac2
Make response caching work with runtime generated IR
alloy f6a8ac0
Change files
alloy be24fd3
Fix typing
alloy 6db5f0c
[package] Add graphql-js resolution
alloy ca002b0
applying package updates
gql-svc 7efebd5
Import relay-compiler v12.0.0 code needed for runtime IR generation
alloy cc2d6dd
Change files
alloy 20c3b09
Remove unnecessary types package
alloy 981b1dd
applying package updates
gql-svc 62f3a98
[build] Include js files
alloy 77398e0
Change files
alloy 655a0d9
More dep fixes
alloy 0330dda
Change files
alloy ab9a403
Deal with situation where document contains multiple definitions
alloy c894678
Change files
alloy 107451d
Fix type errors
alloy cba5a0f
Change files
alloy fdf43e0
Actually import vebdored files
alloy 5a87732
Change files
alloy 9c580aa
Fix type errors definitively
alloy b14675e
Change files
alloy 74b28d3
applying package updates
gql-svc ae4051c
Add missing dep
alloy 30cc558
Change files
alloy b436cec
applying package updates
gql-svc 5d3502b
Try to not compile the vendored js
alloy 0293518
Change files
alloy 7c8353e
applying package updates
gql-svc 453d27a
Import original sources without babel stuff
alloy 92307f5
Change files
alloy 1fff49c
applying package updates
gql-svc 448f487
Package cleaning
alloy 87555d5
Use ES6 imports to fix webpack requires
alloy fc8f30c
Also use ES6 exports
alloy 4a52637
Filter out duplicate references to fragments
alloy 0b523f5
Change files
alloy 5519783
Change to TS files
alloy 5344783
applying package updates
gql-svc 56fce0b
Add __typename field selection
alloy 45f0124
Only add __typename when generating IR at runtime
alloy 11684c7
Cache documents with __typename and deduped definitions
alloy a26dda7
Cleanup package
alloy 4d0796c
Cleanup
alloy 8b1437a
Remove inline snapshots, as they alas cannot be updated easily when u…
alloy cb98fb6
Ensure documents always have __typename added, including when interac…
alloy 2aac925
Hack Relay bits to allow duplicate operation/fragment definition name…
alloy 1af390a
Register a dummy environment with the relay devtools to inspect the s…
alloy 1c1346f
Add id value to data to write as part of fragment
alloy cb16249
Deal with @client fields when writing and not including them
alloy e4cd0b3
Change files
alloy 0fee2bc
applying package updates
gql-svc 6992e49
Support most of TypePolicies.keyFields
alloy 1d1d728
Rewrite IR plugin
alloy 0f96556
Change files
alloy 3dcb5de
Type fixes
alloy 78e9e07
Support multiple documents in a single file
alloy a6188c1
applying package updates
gql-svc 9666de5
Fix fragment name deduping
alloy 0707f94
Change files
alloy 9c02fdf
applying package updates
gql-svc 50a6c2e
Use the codegen plugin
alloy 6916e6b
Change files
alloy 004ff36
applying package updates
gql-svc c6476ca
Change files
alloy 149de99
applying package updates
gql-svc 6ce1fac
Generate typename selection for abstract types
alloy 00250c1
Emit connection metadata
alloy cdffed3
Make integration test use codegen plugin
alloy d05df28
Update test schema to have a connection
alloy 291c49c
Provide connection handler
alloy 1c812c3
Emit complete Relay IR
alloy 25dc9b0
Change files
alloy 5fdc27a
Add missing typings
alloy da535a3
More type fixes
alloy 335dc6c
applying package updates
gql-svc ac8d1fd
Inline fragments into operation IR
alloy c3a1eca
Change files
alloy 7fee99f
Transform @connection filter->filters param
alloy e4fc7f9
Vendor inline transform and patch only that for our needs
alloy d3a6ce1
Change files
alloy 04717bc
Fix typings
alloy 0f60779
applying package updates
gql-svc 284cd57
Add typename selection everywhere
alloy 19b8ac4
Read field policies
freiksenet 0479db3
Change files
freiksenet 1a6beb1
Change files
freiksenet c8b642a
applying package updates
gql-svc 81ea738
Fix check options signature
freiksenet bdf33d2
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
freiksenet a4578f4
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet a5a9183
Merge upgrade
freiksenet 9f69437
Change files
freiksenet daa1a31
Lint fixes post merge
freiksenet 9194bec
WIP keyargs
freiksenet b24e1c8
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet 0472c2b
Unneeded changes
freiksenet a0bf17d
Remove unneded change fileS
freiksenet 39bade6
Remove tests
freiksenet f17ce20
Actually decode locations
freiksenet f81618f
Add tests
freiksenet dfa1f89
Better tests
freiksenet 10ef76d
Change files
freiksenet 7a60075
Merging
freiksenet 2c2771e
Fixes
freiksenet d7a5971
Merge branch 'mnovikov/fix-supermassive-decode' into alloy/relay-apol…
freiksenet a6c78ee
Fixes
freiksenet fb751de
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet f9fc357
Removed change
freiksenet 17992c8
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet b392cc4
Relay 15
freiksenet 348b192
Patches
freiksenet c01a558
Change files
freiksenet 11b3af1
Changes
freiksenet d73f011
Unusued
freiksenet 9ec599b
applying package updates
gql-svc 721da21
Cache
freiksenet 1970657
WIP
freiksenet c9c50e4
Change files
freiksenet 43dd6bc
applying package updates
gql-svc 0ed7738
More fixes
freiksenet e078320
Change files
freiksenet 149d154
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
freiksenet be7af4e
Wrong doc to spread :/
freiksenet 3e06bad
Change files
freiksenet f1d3b87
applying package updates
gql-svc abfecd4
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet 51d66d6
Change files
freiksenet 7ed128e
Change files
freiksenet 324dc87
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet 8fc1c9d
applying package updates
gql-svc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules/ | ||
| dist/ | ||
| yarn-error.log | ||
| stats/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "tabWidth": 2, | ||
| "useTabs": false | ||
| } |
143 changes: 143 additions & 0 deletions
143
examples/supermassive-todomvcs-apollo-style/CHANGELOG.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| { | ||
| "name": "supermassive-todomvc-apollo-style", | ||
| "entries": [ | ||
| { | ||
| "date": "Tue, 19 Dec 2023 10:42:14 GMT", | ||
| "tag": "supermassive-todomvc-apollo-style_v1.0.0", | ||
| "version": "1.0.0", | ||
| "comments": { | ||
| "undefined": [ | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/apollo-react-relay-duct-tape to v1.0.23", | ||
| "commit": "324dc87a3bb3b6c549e3316efca692072256dec7" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/graphql-js-tag to v0.9.1", | ||
| "commit": "324dc87a3bb3b6c549e3316efca692072256dec7" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/supermassive to v3.2.7", | ||
| "commit": "324dc87a3bb3b6c549e3316efca692072256dec7" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/ts-transform-graphql-js-tag to v1.2.0", | ||
| "commit": "324dc87a3bb3b6c549e3316efca692072256dec7" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "date": "Wed, 04 Oct 2023 14:49:50 GMT", | ||
| "tag": "supermassive-todomvc-apollo-style_v1.0.0", | ||
| "version": "1.0.0", | ||
| "comments": { | ||
| "undefined": [ | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/apollo-react-relay-duct-tape to v1.0.14", | ||
| "commit": "3e06badb76f78b85df97be32f596710627098870" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/graphql-js-tag to v0.9.1", | ||
| "commit": "3e06badb76f78b85df97be32f596710627098870" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/supermassive to v3.2.0", | ||
| "commit": "3e06badb76f78b85df97be32f596710627098870" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/ts-transform-graphql-js-tag to v1.1.1", | ||
| "commit": "3e06badb76f78b85df97be32f596710627098870" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "date": "Wed, 04 Oct 2023 13:51:41 GMT", | ||
| "tag": "supermassive-todomvc-apollo-style_v1.0.0", | ||
| "version": "1.0.0", | ||
| "comments": { | ||
| "undefined": [ | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/apollo-react-relay-duct-tape to v1.0.14", | ||
| "commit": "c9c50e4c6bfb1bc50376cd5228b5ad8fe9cc2274" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/graphql-js-tag to v0.9.1", | ||
| "commit": "c9c50e4c6bfb1bc50376cd5228b5ad8fe9cc2274" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/supermassive to v3.2.0", | ||
| "commit": "c9c50e4c6bfb1bc50376cd5228b5ad8fe9cc2274" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/ts-transform-graphql-js-tag to v1.1.1", | ||
| "commit": "c9c50e4c6bfb1bc50376cd5228b5ad8fe9cc2274" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "date": "Wed, 04 Oct 2023 10:42:36 GMT", | ||
| "tag": "supermassive-todomvc-apollo-style_v1.0.0", | ||
| "version": "1.0.0", | ||
| "comments": { | ||
| "none": [ | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/apollo-react-relay-duct-tape to v1.0.14", | ||
| "commit": "d73f011a40f790860efd1324823dbe5b24bf0927" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/graphql-js-tag to v0.9.1", | ||
| "commit": "d73f011a40f790860efd1324823dbe5b24bf0927" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/supermassive to v3.2.0", | ||
| "commit": "d73f011a40f790860efd1324823dbe5b24bf0927" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/ts-transform-graphql-js-tag to v1.1.1", | ||
| "commit": "d73f011a40f790860efd1324823dbe5b24bf0927" | ||
| }, | ||
| { | ||
| "author": "beachball", | ||
| "package": "supermassive-todomvc-apollo-style", | ||
| "comment": "Bump @graphitation/graphql-codegen-relay-ir-plugin to v1.3.0", | ||
| "commit": "d73f011a40f790860efd1324823dbe5b24bf0927" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| schema: "./src/schema/typeDefs.graphql" | ||
| documents: ["src/components/**/*.graphql"] | ||
| generates: | ||
| ./src/__generated__/types.ts: | ||
| plugins: | ||
| - typescript | ||
| - add: | ||
| content: > | ||
| // THIS FILE IS GENERATED BY graphql-codegen. DO NOT MODIFY! | ||
|
|
||
| // RUN `yarn generate:interfaces` from the package root to update it | ||
|
|
||
| // See <PACKAGE_ROOT>/codegen.yml for details | ||
|
|
||
| /* eslint-disable */ | ||
|
|
||
| // @ts-nocheck | ||
| ./src/components/: | ||
| preset: near-operation-file | ||
| presetConfig: | ||
| extension: .graphql.interface.ts | ||
| baseTypesPath: ./src/__generated__/types.ts | ||
| plugins: | ||
| - typescript-operations | ||
| - "@graphitation/graphql-codegen-relay-ir-plugin" | ||
| - add: | ||
| content: > | ||
| // THIS FILE IS GENERATED BY graphql-codegen. DO NOT MODIFY! | ||
|
|
||
| // RUN `yarn generate:interfaces` from the package root to update it | ||
|
|
||
| // See <PACKAGE_ROOT>/codegen.yml for details | ||
|
|
||
| /* eslint-disable */ | ||
|
|
||
| // @ts-nocheck | ||
| config: | ||
| noGraphQLTag: true | ||
| immutableTypes: true | ||
| preResolveTypes: true | ||
| namingConvention: "keep" | ||
| dedupeOperationSuffix: true | ||
| avoidOptionals: { field: true } | ||
| nonOptionalTypename: true | ||
| skipTypeNameForRoot: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| "name": "supermassive-todomvc-apollo-style", | ||
| "main": "index.js", | ||
| "private": true, | ||
| "version": "1.0.0", | ||
| "scripts": { | ||
| "start": "graphql-codegen && yarn serve --progress --color --mode=development", | ||
| "build": "", | ||
| "serve": "webpack serve --config webpack.config.ts", | ||
| "extract-schema": "supermassive extract-schema ./src/schema/typeDefs.graphql", | ||
| "codegen": "graphql-codegen" | ||
| }, | ||
| "dependencies": { | ||
| "@apollo/client": "^3.6.0", | ||
| "@babel/runtime": "^7.12.0", | ||
| "@graphitation/apollo-react-relay-duct-tape": "^0.7.0", | ||
| "@graphitation/graphql-codegen-supermassive-relay-ir-plugin": "link:../packages/graphql-codegen-supermassive-relay-ir-plugin", | ||
| "@graphitation/graphql-js-tag": "^0.9.0", | ||
| "@graphitation/supermassive": "^3.0.0", | ||
| "@graphitation/ts-transform-graphql-js-tag": "^1.1.0", | ||
| "concurrently": "^6.5.1", | ||
| "event-iterator": "^2.0.0", | ||
| "graphql": "^15.6.1", | ||
| "graphql-tools": "^8.2.0", | ||
| "html-webpack-plugin": "^5.3.2", | ||
| "lodash": "^4.17.21", | ||
| "react": "^17.0.2", | ||
| "react-dom": "^17.0.2", | ||
| "react-relay": "^14.0.0", | ||
| "relay-compiler": "^12.0.0", | ||
| "relay-compiler-language-graphitation": "^0.8.2", | ||
| "relay-runtime": "^14.0.0", | ||
| "ts-loader": "^9.0.0", | ||
| "ts-node": "^10.4.0", | ||
| "uuid": "^8.3.2", | ||
| "webpack": "^5.76.0", | ||
| "webpack-cli": "^4.6.0", | ||
| "webpack-dev-server": "^3.1.14", | ||
| "webpack-graphql-loader": "^1.0.2", | ||
| "zen-observable": "^0.8.15" | ||
| }, | ||
| "resolutions": { | ||
| "ansi-html": "^0.0.9", | ||
| "ansi-regex": "^5.0.1", | ||
| "cross-fetch": "^3.1.5", | ||
| "eventsource": "^2.0.2", | ||
| "graphql": "^15.6.1", | ||
| "glob-parent": "^6.0.2", | ||
| "mem": "^4.3.0", | ||
| "minimist": "^1.2.6", | ||
| "node-fetch": "^2.6.7", | ||
| "node-forge": "^1.3.1", | ||
| "yargs-parser": ">=13.1.2", | ||
| "typescript": "^4.9.5" | ||
| }, | ||
| "devDependencies": { | ||
| "@graphitation/graphql-codegen-relay-ir-plugin": "^1.3.0", | ||
| "@graphql-codegen/cli": "^1.19.4", | ||
| "@graphql-codegen/import-types-preset": "^2.1.7", | ||
| "@graphql-codegen/near-operation-file-preset": "^2.4.1", | ||
| "@graphql-codegen/typed-document-node": "^2.3.3", | ||
| "@graphql-codegen/typescript": "^2.2.0", | ||
| "@graphql-codegen/typescript-operations": "^2.2.4", | ||
| "@graphql-codegen/typescript-react-apollo": "^3.3.3", | ||
| "@types/graphql": "^14.5.0", | ||
| "@types/lodash": "^4.14.175", | ||
| "@types/react": "^17.0.30", | ||
| "@types/react-dom": "^17.0.9", | ||
| "@types/react-relay": "14.1.1", | ||
| "@types/uuid": "^8.3.1", | ||
| "add": "^2.0.6", | ||
| "graphql-let": "^0.18.5", | ||
| "prettier": "^2.4.1", | ||
| "yarn": "^1.22.19" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import { | ||
| ApolloClient, | ||
| InMemoryCache, | ||
| from, | ||
| ApolloProvider, | ||
| } from "@apollo/client"; | ||
| import { RelayApolloCache } from "../../../packages/relay-apollo-duct-tape/src/Cache"; | ||
| import React from "react"; | ||
| import { onError } from "@apollo/client/link/error"; | ||
| import TodoList from "./components/TodoList"; | ||
| import { asyncSplit } from "./schema/asyncSplit"; | ||
|
|
||
| const isProduction = false; | ||
|
|
||
| // Log any GraphQL errors or network error that occurred | ||
| const errorLink = onError(({ graphQLErrors, networkError }) => { | ||
| if (graphQLErrors) | ||
| graphQLErrors.forEach((error) => { | ||
| const { message, locations, path } = error; | ||
| console.log( | ||
| `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}` | ||
| ); | ||
| console.error(error); | ||
| }); | ||
| if (networkError) { | ||
| console.log(`[Network error]: ${networkError}`); | ||
| console.error(networkError); | ||
| } | ||
| }); | ||
|
|
||
| const client = new ApolloClient({ | ||
| cache: new RelayApolloCache(), | ||
| link: from([ | ||
| errorLink, | ||
| asyncSplit( | ||
| () => isProduction, | ||
| async () => { | ||
| const { supermassiveSchemaLink } = await import( | ||
| /* webpackChunkName: "supermassiveLink" */ | ||
| "./schema/productionLink" | ||
| ); | ||
| return supermassiveSchemaLink; | ||
| }, | ||
| async () => { | ||
| const { executableSchemaLink } = await import( | ||
| /* webpackChunkName: "executableLink" */ | ||
| "./schema/link" | ||
| ); | ||
| return executableSchemaLink; | ||
| } | ||
| ), | ||
| ]), | ||
| }); | ||
|
|
||
| function App() { | ||
| return ( | ||
| <ApolloProvider client={client}> | ||
| <TodoList /> | ||
| </ApolloProvider> | ||
| ); | ||
| } | ||
|
|
||
| export default App; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@freiksenet I had to resort to this, as I couldn't get
yarn linkto work for the life of me.