From b26f6867f8d5b96ab5b9f35c9b5625d6e80054a7 Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Sat, 1 Apr 2023 11:37:58 +0200 Subject: [PATCH 1/6] Update clientAtom.ts Fix createClient to work with urql v4 --- src/clientAtom.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/clientAtom.ts b/src/clientAtom.ts index 0aebcfc..c43b5e8 100644 --- a/src/clientAtom.ts +++ b/src/clientAtom.ts @@ -1,4 +1,4 @@ -import { createClient } from '@urql/core' +import { createClient, cacheExchange, fetchExchange } from '@urql/core' import { atom } from 'jotai/vanilla' const DEFAULT_URL = @@ -10,4 +10,7 @@ const DEFAULT_URL = } })() || '/graphql' -export const clientAtom = atom(createClient({ url: DEFAULT_URL })) +export const clientAtom = atom(createClient({ + url: DEFAULT_URL, + exchanges: [cacheExchange, fetchExchange] +})) From 45d9ee40529a4a44124ad1a911a4305fe6d55bfd Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Sat, 1 Apr 2023 09:41:02 +0000 Subject: [PATCH 2/6] update urql dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e604012..ae20b20 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@types/react-dom": "^18.0.10", "@typescript-eslint/eslint-plugin": "^5.50.0", "@typescript-eslint/parser": "^5.50.0", - "@urql/core": "^3.1.1", + "@urql/core": "^4.0.0", "eslint": "^8.33.0", "eslint-config-prettier": "^8.6.0", "eslint-import-resolver-alias": "^1.1.2", From 5139126958d0a7891e83927f79422173d51e3324 Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Sat, 1 Apr 2023 09:41:45 +0000 Subject: [PATCH 3/6] install dependencies --- yarn.lock | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8b9fbe0..9d34ca7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@0no-co/graphql.web@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@0no-co/graphql.web/-/graphql.web-1.0.0.tgz#af3f5e3b9359d2f011bc37a93654348b92d4d893" + integrity sha512-JBq2pWyDchE1vVjj/+c4dzZ8stbpew4RrzpZ3vYdn1WJFGHfYg6YIX1fDdMKtSXJJM9FUlsoDOxemr9WMM2p+A== + "@ampproject/remapping@^2.1.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" @@ -1852,12 +1857,13 @@ "@typescript-eslint/types" "5.50.0" eslint-visitor-keys "^3.3.0" -"@urql/core@^3.1.1": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@urql/core/-/core-3.1.1.tgz#a49cd572360d01f2469a786b294fba2269a65e53" - integrity sha512-Mnxtq4I4QeFJsgs7Iytw+HyhiGxISR6qtyk66c9tipozLZ6QVxrCiUPF2HY4BxNIabaxcp+rivadvm8NAnXj4Q== +"@urql/core@^4.0.0": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@urql/core/-/core-4.0.1.tgz#48d445a079e4d1bb87ad3fdba62a7b64ea88e72a" + integrity sha512-4KfEAjonkQbthkAAQzaodZlj34tN/E3uqyxg6I3Hc3QFe7Mvuw4xdduWJuVXBbr4+FWVy+XKjPxDlgiewHVjxQ== dependencies: - wonka "^6.1.2" + "@0no-co/graphql.web" "^1.0.0" + wonka "^6.3.0" "@webassemblyjs/ast@1.11.1": version "1.11.1" @@ -7705,10 +7711,10 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== -wonka@^6.1.2: - version "6.1.2" - resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.1.2.tgz#2c66fa5b26a12f002a03619b988258313d0b5352" - integrity sha512-zNrXPMccg/7OEp9tSfFkMgTvhhowqasiSHdJ3eCZolXxVTV/aT6HUTofoZk9gwRbGoFey/Nss3JaZKUMKMbofg== +wonka@^6.3.0: + version "6.3.1" + resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.3.1.tgz#315b2a91e134c4032980836e6d97e13d0927634d" + integrity sha512-nJyGPcjuBiaLFn8QAlrHd+QjV9AlPO7snOWAhgx6aX0nQLMV6Wi0nqfrkmsXIH0efngbDOroOz2QyLnZMF16Hw== word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" From 3835269499e3ea02b74787c32c09ee48b04467cf Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Sat, 1 Apr 2023 11:52:15 +0200 Subject: [PATCH 4/6] format using prettier and eslint --- src/clientAtom.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/clientAtom.ts b/src/clientAtom.ts index c43b5e8..fb7ac12 100644 --- a/src/clientAtom.ts +++ b/src/clientAtom.ts @@ -1,4 +1,4 @@ -import { createClient, cacheExchange, fetchExchange } from '@urql/core' +import { cacheExchange, createClient, fetchExchange } from '@urql/core' import { atom } from 'jotai/vanilla' const DEFAULT_URL = @@ -10,7 +10,9 @@ const DEFAULT_URL = } })() || '/graphql' -export const clientAtom = atom(createClient({ - url: DEFAULT_URL, - exchanges: [cacheExchange, fetchExchange] -})) +export const clientAtom = atom( + createClient({ + url: DEFAULT_URL, + exchanges: [cacheExchange, fetchExchange], + }) +) From 7430922b567976582886cb64548634f4bf486d74 Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Sat, 1 Apr 2023 12:21:15 +0200 Subject: [PATCH 5/6] fix example --- examples/01_typescript/src/App.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/01_typescript/src/App.tsx b/examples/01_typescript/src/App.tsx index 532072b..ec27b62 100644 --- a/examples/01_typescript/src/App.tsx +++ b/examples/01_typescript/src/App.tsx @@ -1,10 +1,13 @@ import React, { Suspense } from 'react' -import { createClient } from '@urql/core' +import { cacheExchange, createClient, fetchExchange } from '@urql/core' import { useAtom } from 'jotai/react' import { atom } from 'jotai/vanilla' import { atomsWithQuery } from 'jotai-urql' -const client = createClient({ url: 'https://countries.trevorblades.com/' }) +const client = createClient({ + url: 'https://countries.trevorblades.com/', + exchanges: [cacheExchange, fetchExchange], +}) const codeAtom = atom('en') From b51a0132afcd7ebba404edc27183f3639bd9ed4f Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Sat, 1 Apr 2023 13:51:50 +0200 Subject: [PATCH 6/6] update version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae20b20..448a466 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jotai-urql", "description": "👻🦅", - "version": "0.5.0", + "version": "0.6.0", "author": "Daishi Kato", "repository": { "type": "git",