Skip to content

Instantly share code, notes, and snippets.

View acao's full-sized avatar
👀

Rikki Schulte acao

👀
View GitHub Profile
@acao
acao / generate-graphiql-html.ts
Last active August 4, 2023 16:21
Generate a GraphiQL HTML with specific releases.
import type { GraphiQLProps } from 'graphiql';
import type { FetcherOpts } from '@graphiql/toolkit';
export type GenerateGraphiQLOptions = {
plugins?: (
| '@graphiql/plugin-doc-explorer'
| '@graphiql/plugin-explorer'
| '@graphiql/plugin-code-exporter'
)[];
props?: GraphiQLProps;
fetcherOptions?: FetcherOpts;
@acao
acao / graphiql-tab-bug.html
Created June 29, 2023 10:22
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 Plugin RFC

Here is yet another plugin RFC, what do you think?

More details and examples to come

// example-sidebar-plugin.tsx

import {
  useSidebarPlugin,
@acao
acao / graphiql_react_roadmap.md
Last active April 21, 2022 10:09
roadmap for @graphiql/react component library

GraphiQL Roadmap Notes

GraphiQL Component Library Roadmap

Initial Workspace Setup

Begin with setting up @graphiql/react workspace & component library tooling with:

  • storybook/ladle/etc
@acao
acao / schemaLoader.ts
Created April 27, 2020 19:17
example schema loading utilities
import {
getIntrospectionQuery,
IntrospectionOptions,
IntrospectionQuery,
DocumentNode,
BuildSchemaOptions,
buildClientSchema,
buildASTSchema,
buildSchema
} from 'graphql';
@acao
acao / graphqlWorker.ts
Created March 6, 2020 01:53
Example of the graphql monaco worker progress
import * as monaco from 'monaco-editor';
import IWorkerContext = monaco.worker.IWorkerContext;
import * as graphqlService from 'graphql-language-service';
import { GraphQLLanguageService } from 'graphql-language-service-interface';
import {
Position,
Diagnostic,
import { Component } from 'react';
import { GraphQLSchema } from 'graphql';
export interface GraphiQL extends Component<GraphiQLProps, GraphiQLState> {}
export interface GraphiQLProps {
fetcher?: (props: { query: string; operationName: string }) => Promise<any>;
schema?: GraphQLSchema;
query?: string;
variables?: string;
operationName?: string;
@acao
acao / renderGraphiql.js
Created November 8, 2019 03:20
renderGraphiQL Helper
import React from 'react';
import ReactDOM from 'react-dom';
import { GraphiQL } from './components/GraphiQL';
const logger = console;
const defaultOptions = {
containerId: 'root',
url: 'http://localhost:8080',
};
@acao
acao / graphiql.min.js
Created April 9, 2019 16:01
graphiql - inputUnion branch
This file has been truncated, but you can view the full file.
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).GraphiQL=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceInterface=require("graphql-language-service-interface");_codemirror2.default.registerHelper("hint","graphql",function(editor,
@acao
acao / index.html
Created October 28, 2017 19:09
Get/Set Benchmark Step 3
<script>
var suite = new Benchmark.Suite();
const obj = {
stuff: {
things: {
stuff: 'things',
things: 'stuff',
other: {
stuff: 'things'
}