Skip to content
Draft
Show file tree
Hide file tree
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 Jul 5, 2022
5b960b5
[relay-apollo-duct-tape] Working query/fragment reading/writing
alloy Jul 8, 2022
c76be43
[package] Use latest apollo in workspace root
alloy Sep 19, 2022
8d97348
[patches] Make apollo cache interface use relay IR
alloy Sep 19, 2022
c30cd6a
[relay-duct-tape] Start implementing proper interface
alloy Sep 19, 2022
aaed906
[relay-duct-tape] Implement read/write
alloy Sep 19, 2022
fa42afe
Outputting IR
freiksenet Sep 19, 2022
a8d00dd
[relay-duct-tape] Implement Cache.watch
alloy Sep 19, 2022
ba4803a
Naming
alloy Sep 19, 2022
a872866
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
freiksenet Sep 19, 2022
2c39cfc
MVC wIP
freiksenet Sep 19, 2022
caefbb0
Minor stuff
alloy Sep 19, 2022
cc87f1e
[relay-duct-tape] Skip environment for store writing
alloy Sep 20, 2022
484fbd3
[relay-duct-tape] Use store more directly, rather than through enviro…
alloy Sep 20, 2022
27d84d6
[relay-duct-tape] Implement batching
alloy Sep 20, 2022
8db60ca
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
alloy Sep 20, 2022
24ead2a
[relay-duct-tape] Implement Cache.diff
alloy Sep 20, 2022
f32a62a
Cleanup
alloy Sep 20, 2022
ca083ba
[relay-duct-tape] Implement optimistic writing/reading
alloy Sep 21, 2022
63c6c42
[relay-duct-tape] Implement serialization
alloy Sep 21, 2022
472f37a
Cleanup
alloy Sep 21, 2022
999f312
Cleanup
alloy Sep 21, 2022
68632d1
[relay-duct-tape] Revert optimistic transaction updates
alloy Sep 21, 2022
09a58f3
[relay-duct-tape] Rename to RelayApolloCache
alloy Sep 21, 2022
4bedd72
Cleanup
alloy Sep 21, 2022
8c77ea9
[relay-duct-tape] Handle partial data
alloy Sep 21, 2022
a785413
[relay-duct-tape] List big TODOs
alloy Sep 21, 2022
810985a
Sort of working
freiksenet Sep 21, 2022
13c499c
Hackity hack
freiksenet Sep 21, 2022
e08ed9c
Generating flattened
freiksenet Sep 22, 2022
d2f38e9
[relay-duct-tape] Support type-policies key-fields
alloy Sep 22, 2022
5dbf1a7
[relay-duct-tape] Use DocumentNode.__relay
alloy Sep 22, 2022
dd41ea0
[relay-duct-tape/example] Fix cache initialization
alloy Sep 22, 2022
cd6092b
[relay-duct-tape/example] Start with some data
alloy Sep 22, 2022
e2c4ca6
[relay-duct-tape/example] Alternative link method
alloy Sep 22, 2022
13f4057
[relay-duct-tape] Package cleanup
alloy Sep 22, 2022
507ad98
[relay-duct-tape] Prep for release
alloy Sep 22, 2022
9d6ee86
[ci] Prep for relay-duct-tape release
alloy Sep 22, 2022
ddd4f92
Change files
alloy Sep 22, 2022
1a6b087
Make TS checking green
alloy Sep 22, 2022
cb25ca8
More type faffing
alloy Sep 22, 2022
fc2ecee
More TS fixes
alloy Sep 22, 2022
8ca3769
More TS faffing
alloy Sep 22, 2022
e0c831b
More TS fixes
alloy Sep 22, 2022
b448dfb
[package] sync
alloy Sep 22, 2022
a4cc859
applying package updates
gql-svc Sep 22, 2022
6b78d25
Fix package
freiksenet Sep 23, 2022
bc7de70
Change files
freiksenet Sep 23, 2022
6474938
applying package updates
gql-svc Sep 23, 2022
5fa4371
TODO
freiksenet Sep 23, 2022
79d89d2
[example/relay-duct-tape] Fixes
alloy Sep 26, 2022
5fea593
[example/relay-duct-tape] Make mutation/subscription work
alloy Sep 26, 2022
ea4cd39
[example/relay-duct-tape] Add mutations and subscriptions
alloy Sep 27, 2022
d6a40d5
[relay-duct-tape] Add mutation integratio tests
alloy Sep 28, 2022
e95e79b
[relay-duct-tape] Add subscription integration tests
alloy Sep 29, 2022
75b1e07
[relay-duct-tape] Add read memoization
alloy Nov 17, 2022
f248258
Change files
alloy Nov 17, 2022
0b70d96
applying package updates
gql-svc Nov 18, 2022
6ae873a
Start lazy generating IR
alloy Dec 12, 2022
a5ac058
Working version
alloy Dec 12, 2022
a2d7ac2
Make response caching work with runtime generated IR
alloy Dec 13, 2022
f6a8ac0
Change files
alloy Dec 13, 2022
be24fd3
Fix typing
alloy Dec 14, 2022
6db5f0c
[package] Add graphql-js resolution
alloy Dec 14, 2022
ca002b0
applying package updates
gql-svc Dec 14, 2022
7efebd5
Import relay-compiler v12.0.0 code needed for runtime IR generation
alloy Dec 14, 2022
cc2d6dd
Change files
alloy Dec 14, 2022
20c3b09
Remove unnecessary types package
alloy Dec 14, 2022
981b1dd
applying package updates
gql-svc Dec 14, 2022
62f3a98
[build] Include js files
alloy Dec 15, 2022
77398e0
Change files
alloy Dec 15, 2022
655a0d9
More dep fixes
alloy Dec 15, 2022
0330dda
Change files
alloy Dec 15, 2022
ab9a403
Deal with situation where document contains multiple definitions
alloy Dec 15, 2022
c894678
Change files
alloy Dec 15, 2022
107451d
Fix type errors
alloy Dec 15, 2022
cba5a0f
Change files
alloy Dec 15, 2022
fdf43e0
Actually import vebdored files
alloy Dec 15, 2022
5a87732
Change files
alloy Dec 15, 2022
9c580aa
Fix type errors definitively
alloy Dec 16, 2022
b14675e
Change files
alloy Dec 16, 2022
74b28d3
applying package updates
gql-svc Dec 16, 2022
ae4051c
Add missing dep
alloy Dec 16, 2022
30cc558
Change files
alloy Dec 16, 2022
b436cec
applying package updates
gql-svc Dec 16, 2022
5d3502b
Try to not compile the vendored js
alloy Dec 16, 2022
0293518
Change files
alloy Dec 16, 2022
7c8353e
applying package updates
gql-svc Dec 16, 2022
453d27a
Import original sources without babel stuff
alloy Dec 16, 2022
92307f5
Change files
alloy Dec 16, 2022
1fff49c
applying package updates
gql-svc Dec 16, 2022
448f487
Package cleaning
alloy Dec 19, 2022
87555d5
Use ES6 imports to fix webpack requires
alloy Dec 19, 2022
fc8f30c
Also use ES6 exports
alloy Dec 19, 2022
4a52637
Filter out duplicate references to fragments
alloy Dec 19, 2022
0b523f5
Change files
alloy Dec 19, 2022
5519783
Change to TS files
alloy Dec 19, 2022
5344783
applying package updates
gql-svc Dec 19, 2022
56fce0b
Add __typename field selection
alloy Dec 20, 2022
45f0124
Only add __typename when generating IR at runtime
alloy Dec 20, 2022
11684c7
Cache documents with __typename and deduped definitions
alloy Dec 20, 2022
a26dda7
Cleanup package
alloy Dec 21, 2022
4d0796c
Cleanup
alloy Dec 21, 2022
8b1437a
Remove inline snapshots, as they alas cannot be updated easily when u…
alloy Jan 12, 2023
cb98fb6
Ensure documents always have __typename added, including when interac…
alloy Dec 21, 2022
2aac925
Hack Relay bits to allow duplicate operation/fragment definition name…
alloy Dec 23, 2022
1af390a
Register a dummy environment with the relay devtools to inspect the s…
alloy Dec 23, 2022
1c1346f
Add id value to data to write as part of fragment
alloy Dec 23, 2022
cb16249
Deal with @client fields when writing and not including them
alloy Jan 10, 2023
e4cd0b3
Change files
alloy Jan 12, 2023
0fee2bc
applying package updates
gql-svc Jan 12, 2023
6992e49
Support most of TypePolicies.keyFields
alloy Jan 17, 2023
1d1d728
Rewrite IR plugin
alloy Jan 20, 2023
0f96556
Change files
alloy Jan 21, 2023
3dcb5de
Type fixes
alloy Jan 21, 2023
78e9e07
Support multiple documents in a single file
alloy Jan 21, 2023
a6188c1
applying package updates
gql-svc Jan 21, 2023
9666de5
Fix fragment name deduping
alloy Jan 21, 2023
0707f94
Change files
alloy Jan 21, 2023
9c02fdf
applying package updates
gql-svc Jan 21, 2023
50a6c2e
Use the codegen plugin
alloy Jan 22, 2023
6916e6b
Change files
alloy Jan 22, 2023
004ff36
applying package updates
gql-svc Jan 22, 2023
c6476ca
Change files
alloy Jan 23, 2023
149de99
applying package updates
gql-svc Jan 23, 2023
6ce1fac
Generate typename selection for abstract types
alloy Jan 23, 2023
00250c1
Emit connection metadata
alloy Jan 23, 2023
cdffed3
Make integration test use codegen plugin
alloy Jan 25, 2023
d05df28
Update test schema to have a connection
alloy Jan 25, 2023
291c49c
Provide connection handler
alloy Jan 25, 2023
1c812c3
Emit complete Relay IR
alloy Jan 26, 2023
25dc9b0
Change files
alloy Jan 26, 2023
5fdc27a
Add missing typings
alloy Jan 26, 2023
da535a3
More type fixes
alloy Jan 26, 2023
335dc6c
applying package updates
gql-svc Jan 26, 2023
ac8d1fd
Inline fragments into operation IR
alloy Jan 27, 2023
c3a1eca
Change files
alloy Jan 27, 2023
7fee99f
Transform @connection filter->filters param
alloy Jan 26, 2023
e4fc7f9
Vendor inline transform and patch only that for our needs
alloy Jan 27, 2023
d3a6ce1
Change files
alloy Jan 27, 2023
04717bc
Fix typings
alloy Jan 28, 2023
0f60779
applying package updates
gql-svc Jan 28, 2023
284cd57
Add typename selection everywhere
alloy Feb 24, 2023
19b8ac4
Read field policies
freiksenet Sep 7, 2023
0479db3
Change files
freiksenet Sep 7, 2023
1a6beb1
Change files
freiksenet Sep 7, 2023
c8b642a
applying package updates
gql-svc Sep 7, 2023
81ea738
Fix check options signature
freiksenet Sep 7, 2023
bdf33d2
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
freiksenet Sep 7, 2023
a4578f4
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet Sep 20, 2023
a5a9183
Merge upgrade
freiksenet Sep 20, 2023
9f69437
Change files
freiksenet Sep 20, 2023
daa1a31
Lint fixes post merge
freiksenet Sep 20, 2023
9194bec
WIP keyargs
freiksenet Sep 20, 2023
b24e1c8
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet Sep 27, 2023
0472c2b
Unneeded changes
freiksenet Sep 27, 2023
a0bf17d
Remove unneded change fileS
freiksenet Sep 27, 2023
39bade6
Remove tests
freiksenet Sep 27, 2023
f17ce20
Actually decode locations
freiksenet Sep 27, 2023
f81618f
Add tests
freiksenet Sep 27, 2023
dfa1f89
Better tests
freiksenet Sep 27, 2023
10ef76d
Change files
freiksenet Sep 27, 2023
7a60075
Merging
freiksenet Sep 27, 2023
2c2771e
Fixes
freiksenet Sep 27, 2023
d7a5971
Merge branch 'mnovikov/fix-supermassive-decode' into alloy/relay-apol…
freiksenet Sep 27, 2023
a6c78ee
Fixes
freiksenet Sep 27, 2023
fb751de
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet Sep 28, 2023
f9fc357
Removed change
freiksenet Sep 28, 2023
17992c8
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet Oct 4, 2023
b392cc4
Relay 15
freiksenet Oct 4, 2023
348b192
Patches
freiksenet Oct 4, 2023
c01a558
Change files
freiksenet Oct 4, 2023
11b3af1
Changes
freiksenet Oct 4, 2023
d73f011
Unusued
freiksenet Oct 4, 2023
9ec599b
applying package updates
gql-svc Oct 4, 2023
721da21
Cache
freiksenet Oct 4, 2023
1970657
WIP
freiksenet Oct 4, 2023
c9c50e4
Change files
freiksenet Oct 4, 2023
43dd6bc
applying package updates
gql-svc Oct 4, 2023
0ed7738
More fixes
freiksenet Oct 4, 2023
e078320
Change files
freiksenet Oct 4, 2023
149d154
Merge branch 'alloy/relay-apollo-duct-tape' of https://github.com/mic…
freiksenet Oct 4, 2023
be7af4e
Wrong doc to spread :/
freiksenet Oct 4, 2023
3e06bad
Change files
freiksenet Oct 4, 2023
f1d3b87
applying package updates
gql-svc Oct 4, 2023
abfecd4
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet Nov 1, 2023
51d66d6
Change files
freiksenet Dec 13, 2023
7ed128e
Change files
freiksenet Dec 13, 2023
324dc87
Merge remote-tracking branch 'origin/main' into alloy/relay-apollo-du…
freiksenet Dec 19, 2023
8fc1c9d
applying package updates
gql-svc Dec 19, 2023
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
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-empty-function": "off"
"@typescript-eslint/no-empty-function": "off",
"no-prototype-builtins": "off"
},

"overrides": [
Expand Down
4 changes: 4 additions & 0 deletions examples/supermassive-todomvcs-apollo-style/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
yarn-error.log
stats/
4 changes: 4 additions & 0 deletions examples/supermassive-todomvcs-apollo-style/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
143 changes: 143 additions & 0 deletions examples/supermassive-todomvcs-apollo-style/CHANGELOG.json
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"
}
]
}
}
]
}
45 changes: 45 additions & 0 deletions examples/supermassive-todomvcs-apollo-style/codegen.yml
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
76 changes: 76 additions & 0 deletions examples/supermassive-todomvcs-apollo-style/package.json
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",
Copy link
Member Author

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 link to work for the life of me.

"@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"
}
}
63 changes: 63 additions & 0 deletions examples/supermassive-todomvcs-apollo-style/src/App.tsx
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;
Loading