mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
* Don't build libpg-query package. * Use the WASM build of libpg-query in ai-commands. * Fix missing mdast type. * fix: wasm loading in ai-commands tests * fix: better polyfill * Make the sql-to-rest page to be client-side only. --------- Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import dynamic from 'next/dynamic.js'
|
|
import { ErrorBoundary, FallbackProps } from 'react-error-boundary'
|
|
import { Admonition } from '../admonition'
|
|
import { SqlToRestProps } from './sql-to-rest'
|
|
|
|
function FallbackComponent({ error }: FallbackProps) {
|
|
if (error instanceof Error && error.message === 'WebAssembly is not defined') {
|
|
return (
|
|
<Admonition type="danger" title="WebAssembly is not supported in this browser">
|
|
<p>
|
|
The translator requires WebAssembly to run. Your browser might be outdated or it might
|
|
have a policy that disables WebAssembly.
|
|
</p>
|
|
</Admonition>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Admonition type="danger" title="Something went wrong">
|
|
<pre>{error instanceof Error ? error.message : JSON.stringify(error)}</pre>
|
|
</Admonition>
|
|
)
|
|
}
|
|
|
|
// Lazy load client side to prevent hydration issues when browser produces an error
|
|
const SqlToRest = dynamic(() => import('./sql-to-rest'), { ssr: false })
|
|
|
|
export default function SqlToRestWithFallback(props: SqlToRestProps) {
|
|
return (
|
|
<ErrorBoundary FallbackComponent={FallbackComponent}>
|
|
<SqlToRest {...props} />
|
|
</ErrorBoundary>
|
|
)
|
|
}
|