-
-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Grafast playground by avoiding accessing 'process' in graphile-co…
…nfig (#2270)
- Loading branch information
Showing
5 changed files
with
67 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"graphile-config": patch | ||
--- | ||
|
||
Check that `process` exists before reading from it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,57 @@ | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
import Head from "@docusaurus/Head"; | ||
import React from "react"; | ||
import { ErrorBoundary } from "react-error-boundary"; | ||
|
||
export default function Playground() { | ||
return ( | ||
<BrowserOnly> | ||
{() => { | ||
const PlaygroundInner = require("./PlaygroundInner").default; | ||
<ErrorBoundary | ||
fallbackRender={({ error }) => { | ||
console.dir(error); | ||
const issueStack = (error?.stack ?? error) | ||
?.split("\n") | ||
.slice(0, 2) | ||
.map((s) => s.trim()) | ||
.join(" / "); | ||
return ( | ||
<> | ||
<Head> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
</Head> | ||
<PlaygroundInner /> | ||
</> | ||
<div> | ||
<h2>Something went wrong</h2> | ||
<p> | ||
Sorry about this. Grafast isn't really intended for usage on | ||
the web yet and we seem to break the playground quite frequently | ||
as a consequence. Please{" "} | ||
<strong> | ||
<a | ||
href={`https://github.com/graphile/crystal/issues/new?title=${encodeURIComponent( | ||
`Grafast playground: ${issueStack ?? String(error)}`, | ||
)}`} | ||
> | ||
open an issue | ||
</a> | ||
</strong> | ||
. | ||
</p> | ||
<p>Details:</p> | ||
<pre> | ||
<code>{String(error?.stack ?? error)}</code> | ||
</pre> | ||
</div> | ||
); | ||
}} | ||
</BrowserOnly> | ||
> | ||
<BrowserOnly> | ||
{() => { | ||
const PlaygroundInner = require("./PlaygroundInner").default; | ||
return ( | ||
<> | ||
<Head> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
</Head> | ||
<PlaygroundInner /> | ||
</> | ||
); | ||
}} | ||
</BrowserOnly> | ||
</ErrorBoundary> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters