Skip to content

Commit

Permalink
fix(RenderContainer): remove side effects from constructor (#3357)
Browse files Browse the repository at this point in the history
support ssr with react 18 strict dev mode
  • Loading branch information
lossir authored Feb 15, 2024
1 parent d9a0b28 commit 0a7d610
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/react-ui/internal/RenderContainer/RenderContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export class RenderContainer extends React.Component<RenderContainerProps> {

private readonly rootId: string = RenderContainer.getRootId();

constructor(props: RenderContainerProps) {
super(props);

if (props.children) {
this.mountContainer();
}
}

public shouldComponentUpdate(nextProps: RenderContainerProps) {
if (!this.props.children && nextProps.children) {
this.mountContainer();
Expand All @@ -40,6 +32,10 @@ export class RenderContainer extends React.Component<RenderContainerProps> {
}

public render() {
if (this.props.children) {
this.mountContainer();
}

return <RenderInnerContainer {...this.props} domContainer={this.domContainer} rootId={this.rootId} />;
}

Expand Down

0 comments on commit 0a7d610

Please sign in to comment.