Revert "Enable React StrictMode (#28258)"
This reverts commit da5c97f9fa
.
This commit is contained in:
parent
aa4666469e
commit
fa76ae64f8
7 changed files with 71 additions and 96 deletions
|
@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { StrictMode } from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { IDeferred, defer, sleep } from "matrix-js-sdk/src/utils";
|
import { IDeferred, defer, sleep } from "matrix-js-sdk/src/utils";
|
||||||
|
@ -416,7 +416,6 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
|
||||||
const classes = classNames("mx_Dialog_wrapper mx_Dialog_staticWrapper", this.staticModal.className);
|
const classes = classNames("mx_Dialog_wrapper mx_Dialog_staticWrapper", this.staticModal.className);
|
||||||
|
|
||||||
const staticDialog = (
|
const staticDialog = (
|
||||||
<StrictMode>
|
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<div className={classes}>
|
<div className={classes}>
|
||||||
<Glass className="mx_Dialog_border">
|
<Glass className="mx_Dialog_border">
|
||||||
|
@ -429,7 +428,6 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(staticDialog, ModalManager.getOrCreateStaticContainer());
|
ReactDOM.render(staticDialog, ModalManager.getOrCreateStaticContainer());
|
||||||
|
@ -445,7 +443,6 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
|
||||||
});
|
});
|
||||||
|
|
||||||
const dialog = (
|
const dialog = (
|
||||||
<StrictMode>
|
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<div className={classes}>
|
<div className={classes}>
|
||||||
<Glass className="mx_Dialog_border">
|
<Glass className="mx_Dialog_border">
|
||||||
|
@ -458,7 +455,6 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(() => ReactDOM.render(dialog, ModalManager.getOrCreateContainer()), 0);
|
setTimeout(() => ReactDOM.render(dialog, ModalManager.getOrCreateContainer()), 0);
|
||||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { MutableRefObject, ReactNode, StrictMode } from "react";
|
import React, { MutableRefObject, ReactNode } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
|
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
|
||||||
import { TooltipProvider } from "@vector-im/compound-web";
|
import { TooltipProvider } from "@vector-im/compound-web";
|
||||||
|
@ -167,7 +167,6 @@ export default class PersistedElement extends React.Component<IProps> {
|
||||||
|
|
||||||
private renderApp(): void {
|
private renderApp(): void {
|
||||||
const content = (
|
const content = (
|
||||||
<StrictMode>
|
|
||||||
<MatrixClientContext.Provider value={MatrixClientPeg.safeGet()}>
|
<MatrixClientContext.Provider value={MatrixClientPeg.safeGet()}>
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<div ref={this.collectChild} style={this.props.style}>
|
<div ref={this.collectChild} style={this.props.style}>
|
||||||
|
@ -175,7 +174,6 @@ export default class PersistedElement extends React.Component<IProps> {
|
||||||
</div>
|
</div>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</MatrixClientContext.Provider>
|
</MatrixClientContext.Provider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(content, getOrCreateContainer("mx_persistedElement_" + this.props.persistKey));
|
ReactDOM.render(content, getOrCreateContainer("mx_persistedElement_" + this.props.persistKey));
|
||||||
|
|
|
@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { createRef, SyntheticEvent, MouseEvent, StrictMode } from "react";
|
import React, { createRef, SyntheticEvent, MouseEvent } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { MsgType } from "matrix-js-sdk/src/matrix";
|
import { MsgType } from "matrix-js-sdk/src/matrix";
|
||||||
import { TooltipProvider } from "@vector-im/compound-web";
|
import { TooltipProvider } from "@vector-im/compound-web";
|
||||||
|
@ -118,12 +118,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
||||||
// Insert containing div in place of <pre> block
|
// Insert containing div in place of <pre> block
|
||||||
pre.parentNode?.replaceChild(root, pre);
|
pre.parentNode?.replaceChild(root, pre);
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(<CodeBlock onHeightChanged={this.props.onHeightChanged}>{pre}</CodeBlock>, root);
|
||||||
<StrictMode>
|
|
||||||
<CodeBlock onHeightChanged={this.props.onHeightChanged}>{pre}</CodeBlock>
|
|
||||||
</StrictMode>,
|
|
||||||
root,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: Readonly<IBodyProps>): void {
|
public componentDidUpdate(prevProps: Readonly<IBodyProps>): void {
|
||||||
|
@ -197,11 +192,9 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
||||||
const reason = node.getAttribute("data-mx-spoiler") ?? undefined;
|
const reason = node.getAttribute("data-mx-spoiler") ?? undefined;
|
||||||
node.removeAttribute("data-mx-spoiler"); // we don't want to recurse
|
node.removeAttribute("data-mx-spoiler"); // we don't want to recurse
|
||||||
const spoiler = (
|
const spoiler = (
|
||||||
<StrictMode>
|
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Spoiler reason={reason} contentHtml={node.outerHTML} />
|
<Spoiler reason={reason} contentHtml={node.outerHTML} />
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(spoiler, spoilerContainer);
|
ReactDOM.render(spoiler, spoilerContainer);
|
||||||
|
|
|
@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { StrictMode } from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { PushProcessor } from "matrix-js-sdk/src/pushprocessor";
|
import { PushProcessor } from "matrix-js-sdk/src/pushprocessor";
|
||||||
import { MatrixClient, MatrixEvent, RuleId } from "matrix-js-sdk/src/matrix";
|
import { MatrixClient, MatrixEvent, RuleId } from "matrix-js-sdk/src/matrix";
|
||||||
|
@ -76,11 +76,9 @@ export function pillifyLinks(
|
||||||
const pillContainer = document.createElement("span");
|
const pillContainer = document.createElement("span");
|
||||||
|
|
||||||
const pill = (
|
const pill = (
|
||||||
<StrictMode>
|
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Pill url={href} inMessage={true} room={room} shouldShowPillAvatar={shouldShowPillAvatar} />
|
<Pill url={href} inMessage={true} room={room} shouldShowPillAvatar={shouldShowPillAvatar} />
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(pill, pillContainer);
|
ReactDOM.render(pill, pillContainer);
|
||||||
|
@ -135,7 +133,6 @@ export function pillifyLinks(
|
||||||
|
|
||||||
const pillContainer = document.createElement("span");
|
const pillContainer = document.createElement("span");
|
||||||
const pill = (
|
const pill = (
|
||||||
<StrictMode>
|
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Pill
|
<Pill
|
||||||
type={PillType.AtRoomMention}
|
type={PillType.AtRoomMention}
|
||||||
|
@ -144,7 +141,6 @@ export function pillifyLinks(
|
||||||
shouldShowPillAvatar={shouldShowPillAvatar}
|
shouldShowPillAvatar={shouldShowPillAvatar}
|
||||||
/>
|
/>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(pill, pillContainer);
|
ReactDOM.render(pill, pillContainer);
|
||||||
|
|
|
@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { StrictMode } from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { TooltipProvider } from "@vector-im/compound-web";
|
import { TooltipProvider } from "@vector-im/compound-web";
|
||||||
|
|
||||||
|
@ -53,13 +53,11 @@ export function tooltipifyLinks(rootNodes: ArrayLike<Element>, ignoredNodes: Ele
|
||||||
// wrapping the link with the LinkWithTooltip component, keeping the same children. Ideally we'd do this
|
// wrapping the link with the LinkWithTooltip component, keeping the same children. Ideally we'd do this
|
||||||
// without the superfluous span but this is not something React trivially supports at this time.
|
// without the superfluous span but this is not something React trivially supports at this time.
|
||||||
const tooltip = (
|
const tooltip = (
|
||||||
<StrictMode>
|
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<LinkWithTooltip tooltip={href}>
|
<LinkWithTooltip tooltip={href}>
|
||||||
<span dangerouslySetInnerHTML={{ __html: node.innerHTML }} />
|
<span dangerouslySetInnerHTML={{ __html: node.innerHTML }} />
|
||||||
</LinkWithTooltip>
|
</LinkWithTooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</StrictMode>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(tooltip, node);
|
ReactDOM.render(tooltip, node);
|
||||||
|
|
|
@ -12,7 +12,7 @@ Please see LICENSE files in the repository root for full details.
|
||||||
|
|
||||||
// To ensure we load the browser-matrix version first
|
// To ensure we load the browser-matrix version first
|
||||||
import "matrix-js-sdk/src/browser-index";
|
import "matrix-js-sdk/src/browser-index";
|
||||||
import React, { ReactElement, StrictMode } from "react";
|
import React, { ReactElement } from "react";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { createClient, AutoDiscovery, ClientConfig } from "matrix-js-sdk/src/matrix";
|
import { createClient, AutoDiscovery, ClientConfig } from "matrix-js-sdk/src/matrix";
|
||||||
import { WrapperLifecycle, WrapperOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/WrapperLifecycle";
|
import { WrapperLifecycle, WrapperOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/WrapperLifecycle";
|
||||||
|
@ -111,7 +111,6 @@ export async function loadApp(fragParams: {}, matrixChatRef: React.Ref<MatrixCha
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<wrapperOpts.Wrapper>
|
<wrapperOpts.Wrapper>
|
||||||
<StrictMode>
|
|
||||||
<MatrixChat
|
<MatrixChat
|
||||||
ref={matrixChatRef}
|
ref={matrixChatRef}
|
||||||
onNewScreen={onNewScreen}
|
onNewScreen={onNewScreen}
|
||||||
|
@ -123,7 +122,6 @@ export async function loadApp(fragParams: {}, matrixChatRef: React.Ref<MatrixCha
|
||||||
initialScreenAfterLogin={initialScreenAfterLogin}
|
initialScreenAfterLogin={initialScreenAfterLogin}
|
||||||
defaultDeviceDisplayName={defaultDeviceName}
|
defaultDeviceDisplayName={defaultDeviceName}
|
||||||
/>
|
/>
|
||||||
</StrictMode>
|
|
||||||
</wrapperOpts.Wrapper>
|
</wrapperOpts.Wrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as ReactDOM from "react-dom";
|
import * as ReactDOM from "react-dom";
|
||||||
import React, { StrictMode } from "react";
|
import * as React from "react";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
|
||||||
import * as languageHandler from "../languageHandler";
|
import * as languageHandler from "../languageHandler";
|
||||||
|
@ -105,9 +105,7 @@ export async function showError(title: string, messages?: string[]): Promise<voi
|
||||||
"../async-components/structures/ErrorView"
|
"../async-components/structures/ErrorView"
|
||||||
);
|
);
|
||||||
window.matrixChat = ReactDOM.render(
|
window.matrixChat = ReactDOM.render(
|
||||||
<StrictMode>
|
<ErrorView title={title} messages={messages} />,
|
||||||
<ErrorView title={title} messages={messages} />
|
|
||||||
</StrictMode>,
|
|
||||||
document.getElementById("matrixchat"),
|
document.getElementById("matrixchat"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -118,9 +116,7 @@ export async function showIncompatibleBrowser(onAccept: () => void): Promise<voi
|
||||||
"../async-components/structures/ErrorView"
|
"../async-components/structures/ErrorView"
|
||||||
);
|
);
|
||||||
window.matrixChat = ReactDOM.render(
|
window.matrixChat = ReactDOM.render(
|
||||||
<StrictMode>
|
<UnsupportedBrowserView onAccept={onAccept} />,
|
||||||
<UnsupportedBrowserView onAccept={onAccept} />
|
|
||||||
</StrictMode>,
|
|
||||||
document.getElementById("matrixchat"),
|
document.getElementById("matrixchat"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue