Skip to content

Commit 86e5ddb

Browse files
committed
Update to React 18
1 parent f5ab3cf commit 86e5ddb

File tree

10 files changed

+89
-178
lines changed

10 files changed

+89
-178
lines changed

package-lock.json

Lines changed: 66 additions & 158 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@
6161
"@types/node-forge": "^1.3.2",
6262
"@types/qrcode.react": "^1.0.0",
6363
"@types/reach__router": "^1.2.4",
64-
"@types/react": "^16.14.29",
64+
"@types/react": "^18.2.72",
6565
"@types/react-autosuggest": "^10.0.1",
6666
"@types/react-beautiful-dnd": "^13.1.8",
67-
"@types/react-dom": "^16.8.25",
67+
"@types/react-dom": "^18.2.22",
6868
"@types/react-fontawesome": "^1.6.4",
6969
"@types/react-window": "^1.8.1",
7070
"@types/remarkable": "^1.7.3",
7171
"@types/semver": "^7.3.1",
7272
"@types/serialize-error": "^2.1.0",
7373
"@types/set-cookie-parser": "0.0.3",
74-
"@types/styled-components": "^5.1.4",
74+
"@types/styled-components": "^5.1.34",
7575
"@types/traverse": "^0.6.32",
7676
"@types/ua-parser-js": "^0.7.33",
7777
"@types/uuid": "^3.4.4",
@@ -114,15 +114,15 @@
114114
"qrcode.react": "^1.0.0",
115115
"randexp": "^0.5.3",
116116
"rawprotoparse": "^0.0.9",
117-
"react": "^16.14.0",
117+
"react": "^18.2.0",
118118
"react-autosuggest": "^10.0.4",
119119
"react-beautiful-dnd": "^13.1.1",
120120
"react-contexify": "^6.0.0",
121-
"react-dom": "^16.14.0",
121+
"react-dom": "^18.2.0",
122122
"react-hotkeys-hook": "^2.1.3",
123123
"react-monaco-editor": "^0.45.0",
124124
"react-reverse-portal": "^2.1.1",
125-
"react-split-pane": "^0.1.84",
125+
"react-split-pane": "^0.1.92",
126126
"react-virtualized-auto-sizer": "^1.0.2",
127127
"react-window": "^1.8.5",
128128
"remarkable": "^1.7.4",

src/components/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ const AppContainer = styled.div<{ inert?: boolean }>`
4545
}
4646
`;
4747

48-
interface ExtendProps extends React.PropsWithChildren<any> {
49-
pageComponent: React.ComponentType<{}>;
48+
interface ExtendProps extends React.ComponentProps<any> {
49+
pageComponent: React.ComponentType<any>;
5050
}
5151

5252
const Route = ({ children, ...props }: ExtendProps & RouteComponentProps): React.ReactElement => {

src/components/common/text-content.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ export const BlankContentPlaceholder = styled.div`
6565
// The __html format is intended to enforce this - those objects
6666
// should only be created during sanitization.
6767
export const ExternalContent = (p: React.HTMLAttributes<HTMLDivElement> & {
68-
content: Html
69-
}) => <Content {..._.omit(p, 'content')} dangerouslySetInnerHTML={p.content} />
68+
htmlContent: Html
69+
}) => <Content {..._.omit(p, 'htmlContent')} dangerouslySetInnerHTML={p.htmlContent} />
7070

7171
// Format blocks of readable text/docs/etc.
7272
export const Content = styled.div`
@@ -146,7 +146,7 @@ export const Content = styled.div`
146146

147147
export const Markdown = (p: { content: string | undefined }) =>
148148
p.content ?
149-
<ExternalContent content={fromMarkdown(
149+
<ExternalContent htmlContent={fromMarkdown(
150150
p.content
151151
.replace(/:suggestion:/g, suggestionIconHtml)
152152
.replace(/:warning:/g, warningIconHtml)

src/components/error-boundary.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ const ErrorOutput = styled.code`
6565
`;
6666

6767
@observer
68-
export class ErrorBoundary extends React.Component {
68+
export class ErrorBoundary extends React.Component<{
69+
children?: React.ReactNode
70+
}> {
6971

7072
@observable
7173
private error: Error | undefined;

src/components/mock/handler-config.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ class TimeoutHandlerConfig extends HandlerConfig<TimeoutHandler> {
13861386
: this.props.ruleType === 'websocket'
13871387
? 'WebSocket'
13881388
: this.props.ruleType === 'webrtc'
1389-
? (() => { throw new Error('Not compatible with WebRTC rules') })
1389+
? (() => { throw new Error('Not compatible with WebRTC rules') })()
13901390
: unreachableCheck(this.props.ruleType)
13911391
} is received, the server will keep the connection open but do nothing.
13921392
With no data or response, most clients will time out and abort the
@@ -1407,7 +1407,7 @@ class CloseConnectionHandlerConfig extends HandlerConfig<CloseConnectionHandler>
14071407
: this.props.ruleType === 'websocket'
14081408
? 'WebSocket'
14091409
: this.props.ruleType === 'webrtc'
1410-
? (() => { throw new Error('Not compatible with WebRTC rules') })
1410+
? (() => { throw new Error('Not compatible with WebRTC rules') })()
14111411
: unreachableCheck(this.props.ruleType)
14121412
} is received, the connection will be cleanly closed, with no response.
14131413
</ConfigExplanation>
@@ -1426,7 +1426,7 @@ class ResetConnectionHandlerConfig extends HandlerConfig<ResetConnectionHandler>
14261426
: this.props.ruleType === 'websocket'
14271427
? 'WebSocket'
14281428
: this.props.ruleType === 'webrtc'
1429-
? (() => { throw new Error('Not compatible with WebRTC rules') })
1429+
? (() => { throw new Error('Not compatible with WebRTC rules') })()
14301430
: unreachableCheck(this.props.ruleType)
14311431
} is received, the connection will be killed with a TCP RST packet (or a
14321432
RST_STREAM frame, for HTTP/2 requests).

src/components/send/send-tabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const SendTab = observer((props: {
122122
props.onSelectTab(props.sendRequest)
123123
}, [props.onSelectTab, props.sendRequest]);
124124

125-
const onTaxAuxClick = React.useCallback((event) => {
125+
const onTaxAuxClick = React.useCallback((event: React.MouseEvent<HTMLDivElement>) => {
126126
if (event.button === 1) { // Middle mouse click
127127
props.onCloseTab(props.sendRequest);
128128
}

src/components/split-pane.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { styled } from '../styles';
66
// Styles original taken from
77
// https://github.com/tomkp/react-split-pane/blob/master/README.md#example-styling
88
export const SplitPane = styled(ReactSplitPane)<{
9-
hiddenPane?: '1' | '2'
9+
hiddenPane?: '1' | '2',
10+
children?: React.ReactNode // Missing in real types - causes issues in React 18
1011
}>`
1112
.Resizer {
1213
background: #000;

src/components/view/http/http-api-card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function formatValue(value: unknown): string | undefined {
129129

130130
const getDetailsWithWarnings = (details: Html | undefined, warnings: string[]) => [
131131
warnings.length && warnings.map((warning, i) => <Warning key={warning}>{ warning }</Warning>),
132-
details && <ExternalContent key='details' content={details} />
132+
details && <ExternalContent key='details' htmlContent={details} />
133133
].filter(d => !!d);
134134

135135

@@ -187,7 +187,7 @@ const ApiRequestDetails = (props: {
187187
{ api.service.description &&
188188
<CollapsibleSectionBody>
189189
<ServiceLogo src={ api.service.logoUrl } alt='' />
190-
<ExternalContent content={api.service.description} />
190+
<ExternalContent htmlContent={api.service.description} />
191191
<DocsLink href={api.service.docsUrl}>
192192
Find out more
193193
</DocsLink>

src/components/view/http/http-response-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const HttpResponseCard = observer((props: HttpResponseCardProps) => {
4848
const responseDetails = [
4949
apiResponseDescription && <ExternalContent
5050
key='api-response-docs'
51-
content={apiResponseDescription}
51+
htmlContent={apiResponseDescription}
5252
/>,
5353
statusDocs && <Markdown
5454
key='status-docs'

0 commit comments

Comments
 (0)