Skip to content

Instantly share code, notes, and snippets.

@acao
Created June 29, 2023 10:22
Show Gist options
  • Save acao/e1a9527e21b4657a1772f70ceb44e370 to your computer and use it in GitHub Desktop.
Save acao/e1a9527e21b4657a1772f70ceb44e370 to your computer and use it in GitHub Desktop.
Simple duplicate headers tab bug that causes tab creation on reload
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}
#graphiql {
height: 100vh;
}
</style>
<script
crossorigin
src="https://unpkg.com/react@18/umd/react.development.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
></script>
<script crossorigin src="https://unpkg.com/graphiql/graphiql.js"></script>
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
</head>
<body>
<div id="graphiql"></div>
</body>
<script>
function getSchemaUrl() {
return "https://graphiql-test.netlify.app/.netlify/functions/schema-demo";
}
const root = ReactDOM.createRoot(document.getElementById("graphiql"));
root.render(
React.createElement(GraphiQL, {
fetcher: GraphiQL.createFetcher({
url: getSchemaUrl()
}),
headers: '{"a": "b"}',
defaultEditorToolsVisibility: true,
isHeadersEditorEnabled: true,
shouldPersistHeaders: false,
})
);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment