Skip to content

Commit

Permalink
update create react app example to test #3552 issue (#3701)
Browse files Browse the repository at this point in the history
* update create react app example

* Update App.jsx
  • Loading branch information
dimaMachina authored Aug 8, 2024
1 parent c43c0c8 commit c02caf2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 107 deletions.
68 changes: 0 additions & 68 deletions examples/graphiql-create-react-app/CHANGELOG.md

This file was deleted.

11 changes: 5 additions & 6 deletions examples/graphiql-create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -26,7 +26,6 @@
]
},
"devDependencies": {
"eslint-config-react-app": "^5.2.1",
"worker-loader": "^2.0.0"
"eslint-config-react-app": "^7.0.1"
}
}
3 changes: 1 addition & 2 deletions examples/graphiql-create-react-app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<meta name="theme-color" content="#000" />
<meta
name="description"
content="GraphiQL example created using create-react-app"
/>

<title>GraphiQL create-react-app Example</title>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -16,7 +14,7 @@ const fetcher: Fetcher = async graphQLParams => {
credentials: 'same-origin',
},
);
return data.json().catch(() => data.text());
return response.json();
};

const App = () => <GraphiQL fetcher={fetcher} />;
Expand Down
4 changes: 1 addition & 3 deletions examples/graphiql-create-react-app/src/index.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
body {
padding: 0;
margin: 0;
min-height: 100vh;
}
#root {
height: 100vh;
height: 100dvh;
}
Original file line number Diff line number Diff line change
@@ -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(<App />);
1 change: 0 additions & 1 deletion examples/graphiql-create-react-app/src/react-app-env.d.ts

This file was deleted.

19 changes: 0 additions & 19 deletions examples/graphiql-create-react-app/tsconfig.json

This file was deleted.

0 comments on commit c02caf2

Please sign in to comment.