diff --git a/components/canvas/canvas.tsx b/components/canvas/canvas.tsx index f68d6b0ce..07ca5b8e2 100644 --- a/components/canvas/canvas.tsx +++ b/components/canvas/canvas.tsx @@ -1,3 +1,4 @@ +import * as Sentry from '@sentry/node' import { ErrorBoundary } from 'react-error-boundary' import Bounds from './bounds/bounding-box' import BoundsBg from './bounds/bounds-bg' @@ -71,17 +72,18 @@ const MainSVG = styled('svg', { function ErrorFallback({ error, resetErrorBoundary }) { React.useEffect(() => { - const copy = 'Sorry, something went wrong. Clear canvas and continue?' + const copy = + 'Sorry, something went wrong. Press Ok to reset the document, or press cancel to continue and see if it resolves itself.' + console.error(error) + + Sentry.captureException(error) + if (window.confirm(copy)) { - state.send('CLEARED_PAGE') + state.send('RESET_DOCUMENT_STATE') resetErrorBoundary() } }, []) - return ( - - Oops - - ) + return } diff --git a/components/debug-panel/debug-panel.tsx b/components/debug-panel/debug-panel.tsx index 12bf73707..63ea98b9d 100644 --- a/components/debug-panel/debug-panel.tsx +++ b/components/debug-panel/debug-panel.tsx @@ -12,6 +12,7 @@ import { StopIcon, ClipboardIcon, ClipboardCopyIcon, + TrashIcon, } from '@radix-ui/react-icons' import logger from 'state/logger' import { useStateDesigner } from '@state-designer/react' @@ -19,6 +20,9 @@ import { useStateDesigner } from '@state-designer/react' const stopPropagation = (e: React.KeyboardEvent) => e.stopPropagation() const toggleDebugPanel = () => state.send('TOGGLED_DEBUG_PANEL') const handleStateCopy = () => state.send('COPIED_STATE_TO_CLIPBOARD') +const handleError = () => { + throw Error('Error!') +} export default function CodePanel(): JSX.Element { const rContainer = useRef(null) @@ -114,6 +118,12 @@ export default function CodePanel(): JSX.Element { + + Create Error + + + +
{local.isIn('stopped') ? ( diff --git a/pages/index.tsx b/pages/index.tsx index d7671b5b9..4355e2090 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -19,7 +19,7 @@ export default function Home(): JSX.Element { export const getServerSideProps: GetServerSideProps = async (context) => { const session = await getSession(context) - if (!session?.user) { + if (!session?.user && process.env.NODE_ENV !== 'development') { context.res.setHeader('Location', `/sponsorware`) context.res.statusCode = 307 } diff --git a/pages/room/[id].tsx b/pages/room/[id].tsx index afff1a4cf..eb58a2987 100644 --- a/pages/room/[id].tsx +++ b/pages/room/[id].tsx @@ -21,7 +21,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { const session = await getSession(context) const { id } = context.query - if (!session?.user) { + if (!session?.user && process.env.NODE_ENV !== 'development') { context.res.setHeader('Location', `/sponsorware`) context.res.statusCode = 307 } diff --git a/pages/sponsorware.tsx b/pages/sponsorware.tsx index f760049ee..9a14440c2 100644 --- a/pages/sponsorware.tsx +++ b/pages/sponsorware.tsx @@ -67,11 +67,6 @@ export default function Sponsorware(): JSX.Element { export const getServerSideProps: GetServerSideProps = async (context) => { const session = await getSession(context) - if (session?.user) { - context.res.setHeader('Location', `/`) - context.res.statusCode = 307 - } - return { props: { session,