From c02caf25bf9940d36763e73a00a3cdbe47e1f0f7 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Thu, 8 Aug 2024 16:34:22 +0200 Subject: [PATCH] update create react app example to test #3552 issue (#3701) * update create react app example * Update App.jsx --- .../graphiql-create-react-app/CHANGELOG.md | 68 ------------------- .../graphiql-create-react-app/package.json | 11 ++- .../public/index.html | 3 +- .../src/{App.tsx => App.jsx} | 10 ++- .../graphiql-create-react-app/src/index.css | 4 +- .../src/{index.tsx => index.jsx} | 3 +- .../src/react-app-env.d.ts | 1 - .../graphiql-create-react-app/tsconfig.json | 19 ------ 8 files changed, 12 insertions(+), 107 deletions(-) delete mode 100644 examples/graphiql-create-react-app/CHANGELOG.md rename examples/graphiql-create-react-app/src/{App.tsx => App.jsx} (62%) rename examples/graphiql-create-react-app/src/{index.tsx => index.jsx} (57%) delete mode 100644 examples/graphiql-create-react-app/src/react-app-env.d.ts delete mode 100644 examples/graphiql-create-react-app/tsconfig.json diff --git a/examples/graphiql-create-react-app/CHANGELOG.md b/examples/graphiql-create-react-app/CHANGELOG.md deleted file mode 100644 index 2f39755401f..00000000000 --- a/examples/graphiql-create-react-app/CHANGELOG.md +++ /dev/null @@ -1,68 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.11-alpha.8](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.7...example-graphiql-create-react-app@0.1.11-alpha.8) (2021-01-07) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.7](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.6...example-graphiql-create-react-app@0.1.11-alpha.7) (2021-01-07) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.6](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.5...example-graphiql-create-react-app@0.1.11-alpha.6) (2021-01-07) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.5](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.4...example-graphiql-create-react-app@0.1.11-alpha.5) (2021-01-03) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.4](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.3...example-graphiql-create-react-app@0.1.11-alpha.4) (2020-12-28) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.3](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.2...example-graphiql-create-react-app@0.1.11-alpha.3) (2020-08-26) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.2](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.1...example-graphiql-create-react-app@0.1.11-alpha.2) (2020-08-22) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.1](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.11-alpha.0...example-graphiql-create-react-app@0.1.11-alpha.1) (2020-08-12) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.11-alpha.0](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.10...example-graphiql-create-react-app@0.1.11-alpha.0) (2020-08-10) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.10](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.6...example-graphiql-create-react-app@0.1.10) (2020-08-06) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.6](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.5...example-graphiql-create-react-app@0.1.6) (2020-06-11) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.5](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.4...example-graphiql-create-react-app@0.1.5) (2020-06-04) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.4](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.3...example-graphiql-create-react-app@0.1.4) (2020-06-04) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.3](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.2...example-graphiql-create-react-app@0.1.3) (2020-05-28) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## [0.1.2](https://github.com/graphql/graphiql/compare/example-graphiql-create-react-app@0.1.1...example-graphiql-create-react-app@0.1.2) (2020-05-19) - -**Note:** Version bump only for package example-graphiql-create-react-app - -## 0.1.1 (2020-05-17) - -**Note:** Version bump only for package example-graphiql-create-react-app diff --git a/examples/graphiql-create-react-app/package.json b/examples/graphiql-create-react-app/package.json index b7771b270bd..e46b92ee19e 100644 --- a/examples/graphiql-create-react-app/package.json +++ b/examples/graphiql-create-react-app/package.json @@ -3,10 +3,10 @@ "version": "0.0.0", "private": true, "dependencies": { - "graphiql": "^2.2.0", - "graphql": "^16.8.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", + "graphiql": "^3.4.0", + "graphql": "^16.9.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "react-scripts": "5.0.1" }, "scripts": { @@ -26,7 +26,6 @@ ] }, "devDependencies": { - "eslint-config-react-app": "^5.2.1", - "worker-loader": "^2.0.0" + "eslint-config-react-app": "^7.0.1" } } diff --git a/examples/graphiql-create-react-app/public/index.html b/examples/graphiql-create-react-app/public/index.html index 701a1dbef87..010622e92eb 100644 --- a/examples/graphiql-create-react-app/public/index.html +++ b/examples/graphiql-create-react-app/public/index.html @@ -6,12 +6,11 @@ name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> - + - GraphiQL create-react-app Example diff --git a/examples/graphiql-create-react-app/src/App.tsx b/examples/graphiql-create-react-app/src/App.jsx similarity index 62% rename from examples/graphiql-create-react-app/src/App.tsx rename to examples/graphiql-create-react-app/src/App.jsx index 022260f5c67..9175fb03fee 100644 --- a/examples/graphiql-create-react-app/src/App.tsx +++ b/examples/graphiql-create-react-app/src/App.jsx @@ -1,10 +1,8 @@ -import React from 'react'; import { GraphiQL } from 'graphiql'; -import type { Fetcher } from '@graphiql/toolkit'; -import 'graphiql/graphiql.min.css'; +import 'graphiql/graphiql.css'; -const fetcher: Fetcher = async graphQLParams => { - const data = await fetch( +const fetcher = async graphQLParams => { + const response = await fetch( 'https://swapi-graphql.netlify.app/.netlify/functions/index', { method: 'POST', @@ -16,7 +14,7 @@ const fetcher: Fetcher = async graphQLParams => { credentials: 'same-origin', }, ); - return data.json().catch(() => data.text()); + return response.json(); }; const App = () => ; diff --git a/examples/graphiql-create-react-app/src/index.css b/examples/graphiql-create-react-app/src/index.css index d95d5ede303..2b7ec48b007 100644 --- a/examples/graphiql-create-react-app/src/index.css +++ b/examples/graphiql-create-react-app/src/index.css @@ -1,8 +1,6 @@ body { - padding: 0; margin: 0; - min-height: 100vh; } #root { - height: 100vh; + height: 100dvh; } diff --git a/examples/graphiql-create-react-app/src/index.tsx b/examples/graphiql-create-react-app/src/index.jsx similarity index 57% rename from examples/graphiql-create-react-app/src/index.tsx rename to examples/graphiql-create-react-app/src/index.jsx index ac32f49914d..16e6dbd33a2 100644 --- a/examples/graphiql-create-react-app/src/index.tsx +++ b/examples/graphiql-create-react-app/src/index.jsx @@ -1,7 +1,6 @@ -import React from 'react'; import { createRoot } from 'react-dom/client'; import App from './App'; import './index.css'; -const root = createRoot(document.getElementById('root')!); +const root = createRoot(document.getElementById('root')); root.render(); diff --git a/examples/graphiql-create-react-app/src/react-app-env.d.ts b/examples/graphiql-create-react-app/src/react-app-env.d.ts deleted file mode 100644 index 6431bc5fc6b..00000000000 --- a/examples/graphiql-create-react-app/src/react-app-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/graphiql-create-react-app/tsconfig.json b/examples/graphiql-create-react-app/tsconfig.json deleted file mode 100644 index af10394b4c3..00000000000 --- a/examples/graphiql-create-react-app/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react" - }, - "include": ["src"] -}