Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/khaki-dryers-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modern-js/devtools-client': patch
---

fix(devtools): unwrap suspense proxy as object
1 change: 1 addition & 0 deletions packages/devtools/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"react-dom": "^18.2.0",
"react-dom-exp": "npm:[email protected]",
"react-exp": "npm:[email protected]",
"react-error-boundary": "^4.0.12",
"react-icons": "^4.11.0",
"react-is": "^18",
"react-json-tree": "^0.18.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { FallbackProps } from 'react-error-boundary';
import { useRouteError } from '@modern-js/runtime/router';
import { Box, Heading, Text, TextArea } from '@radix-ui/themes';

export type ErrorFallbackProps = FallbackProps;

export const ErrorFallback: React.FC<ErrorFallbackProps> = props => {
const { error } = props;
const title =
error instanceof Error
? `${error.name}: ${error.message}`
: 'Unknown Error';
const description =
error instanceof Error
? error.stack
: Object.prototype.toString.call(error);

return (
<Box p="4">
<Heading as="h4" mb="4">
<Text as="span">{title}</Text>
</Heading>
<TextArea disabled style={{ height: '50vh' }}>
{description}
</TextArea>
</Box>
);
};

export const ErrorRouteHandler: React.FC<ErrorFallbackProps> = props => {
const error = useRouteError();
return <ErrorFallback {...props} error={error} />;
};
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { $framework } from '../../state';
import { ObjectInspector } from '@/components/ObjectInspector';

const Page: React.FC = () => {
const context = useSnapshot($framework.context);
const { context } = useSnapshot($framework);
return <ObjectInspector data={context} sortObjectKeys={true} />;
};

Expand Down
3 changes: 3 additions & 0 deletions packages/devtools/client/src/entries/client/routes/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

.inner-right {
padding-top: var(--breadcrumb-height);
background-color: var(--gray-2);
}

.container {
Expand All @@ -28,6 +27,7 @@
width: var(--navigator-width);
border-right: solid 1px var(--gray-3);
padding: var(--space-1) 0;
background-color: var(--gray-1);
}

.breadcrumbs {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ErrorRouteHandler } from '@/components/ErrorFallback/ErrorFallback';

export default ErrorRouteHandler;
4 changes: 4 additions & 0 deletions packages/devtools/client/src/styles/theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@import '@radix-ui/themes/styles.css';
@import './breakpoints.scss';

:root {
--color-page-background: var(--gray-2) !important;
}

button {
cursor: pointer;
}
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.