diff --git a/.changeset/gold-kings-fix.md b/.changeset/gold-kings-fix.md new file mode 100644 index 00000000..0c46f890 --- /dev/null +++ b/.changeset/gold-kings-fix.md @@ -0,0 +1,5 @@ +--- +'@gqless/react': patch +--- + +[usePaginatedQuery] pause cache changes while merge diff --git a/internal/website/fix-typedoc.js b/internal/website/fix-typedoc.js index 1d16ab15..81ed6213 100644 --- a/internal/website/fix-typedoc.js +++ b/internal/website/fix-typedoc.js @@ -47,6 +47,10 @@ async function main() { ); }) ); + + spawnSync('node', ['./node_modules/pretty-quick/bin/pretty-quick.js'], { + stdio: 'ignore', + }); } main().catch((err) => { diff --git a/internal/website/src/components/Examples/App.tsx b/internal/website/src/components/Examples/App.tsx index 5315af21..fb93b047 100644 --- a/internal/website/src/components/Examples/App.tsx +++ b/internal/website/src/components/Examples/App.tsx @@ -93,7 +93,7 @@ const App = ({ children }: { children?: AppChildren }) => { return ( - + { + const [hideSpinner, setHideSpinner] = useState(false); + + useEffect(() => { + let isMounted = true; + const timeout = setTimeout(() => { + if (isMounted) setHideSpinner(true); + }, 5000); + return () => { + isMounted = false; + clearTimeout(timeout); + }; + }, []); + + if (hideSpinner) return null; + + return ( + + + + ); +}; + +export interface EmbedProps { + file: string; + initialPath: string; +} + +export function CodeSandboxEmbed({ file, initialPath }: EmbedProps) { + const { height } = useWindowSize(0, 400); + + if (!file.startsWith('/')) file = '/' + file; + + const src = `https://codesandbox.io/embed/prod-framework-b3m2q?fontsize=14&hidenavigation=1&module=${encodeURIComponent( + file + )}&theme=dark&initialpath=${encodeURIComponent(initialPath)}`; + + const frameHeight = height - 150; + + return ( + + + + { + document.body.style.overflowY = 'hidden'; + document.body.style.overflowX = 'hidden'; + }} + onMouseOut={() => { + document.body.style.overflowY = 'auto'; + document.body.style.overflowX = 'auto'; + }} + /> + + ); +} diff --git a/internal/website/src/components/Examples/StackblitzEmbed.tsx b/internal/website/src/components/Examples/StackblitzEmbed.tsx deleted file mode 100644 index b26df313..00000000 --- a/internal/website/src/components/Examples/StackblitzEmbed.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { useWindowSize } from 'react-use'; - -import { Box, Spinner, Stack } from '@chakra-ui/react'; - -const EmbedSpinner = () => { - const [hideSpinner, setHideSpinner] = useState(false); - - useEffect(() => { - let isMounted = true; - const timeout = setTimeout(() => { - if (isMounted) setHideSpinner(true); - }, 5000); - return () => { - isMounted = false; - clearTimeout(timeout); - }; - }, []); - - if (hideSpinner) return null; - - return ( - - ); -}; - -export interface StackBlitzProps { - file: string; - initialPath: string; -} - -export function StackBlitzEmbed({ file, initialPath }: StackBlitzProps) { - const { height } = useWindowSize(0, 400); - - return ( - - - - - - ); -} diff --git a/internal/website/src/pages/examples/index.tsx b/internal/website/src/pages/examples/index.tsx index b4292767..c26fbb8f 100644 --- a/internal/website/src/pages/examples/index.tsx +++ b/internal/website/src/pages/examples/index.tsx @@ -33,8 +33,8 @@ export default function Page() { Online Editor and Visualization These examples are made using{' '} - - StackBlitz + + CodeSandbox , which allows you to modify the examples and play with gqless{' '} without installing anything. diff --git a/internal/website/src/pages/examples/suspense/auth.tsx b/internal/website/src/pages/examples/suspense/auth.tsx index 2d6bcae7..552a6606 100644 --- a/internal/website/src/pages/examples/suspense/auth.tsx +++ b/internal/website/src/pages/examples/suspense/auth.tsx @@ -12,14 +12,14 @@ import { useLocation } from '@docusaurus/router'; import { ExamplesPage } from '../../../components/Examples/App'; import { - StackBlitzEmbed, - StackBlitzProps, -} from '../../../components/Examples/StackblitzEmbed'; + CodeSandboxEmbed, + EmbedProps, +} from '../../../components/Examples/Embed'; export default function Page() { const { hash } = useLocation(); - const { file, initialPath } = useMemo(() => { + const { file, initialPath } = useMemo(() => { switch (hash) { case '#headers': { return { @@ -77,7 +77,7 @@ export default function Page() { - + ); } diff --git a/internal/website/src/pages/examples/suspense/query.tsx b/internal/website/src/pages/examples/suspense/query.tsx index 7353199b..00aa2b04 100644 --- a/internal/website/src/pages/examples/suspense/query.tsx +++ b/internal/website/src/pages/examples/suspense/query.tsx @@ -4,7 +4,7 @@ import { Heading, Text } from '@chakra-ui/react'; import Link from '@docusaurus/Link'; import { ExamplesPage } from '../../../components/Examples/App'; -import { StackBlitzEmbed } from '../../../components/Examples/StackblitzEmbed'; +import { CodeSandboxEmbed } from '../../../components/Examples/Embed'; export default function Page() { return ( @@ -15,7 +15,7 @@ export default function Page() { useQuery and{' '} graphql HOC. - + ); }