Skip to content

Commit 4033a9d

Browse files
authored
Merge pull request #645 from lowcoder-org/dev
Dev -> Main with small last fixes for Release 2.3.0
2 parents 82e21ec + 9da2673 commit 4033a9d

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

client/packages/lowcoder-sdk/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useRef } from "react";
22
import ReactDOM, { flushSync } from "react-dom";
3+
import { createRoot } from "react-dom/client";
34
import { AppViewInstance, bootstrapAppAt, LowcoderAppView } from "./src/index";
45

56
const url = new URL(location.href);
@@ -70,7 +71,9 @@ async function bootstrap() {
7071
});
7172

7273
// React
73-
ReactDOM.render(<ReactDemoApp />, document.querySelector("#app2"));
74+
const container = document.querySelector("#app2");
75+
const root = createRoot(container!);
76+
root.render(<ReactDemoApp />);
7477
}
7578

7679
bootstrap();

client/packages/lowcoder-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-sdk",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"type": "module",
55
"files": [
66
"src",

client/packages/lowcoder/src/appView/AppViewInstance.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RootComp } from "comps/comps/rootComp";
44
import { setGlobalSettings } from "comps/utils/globalSettings";
55
import { sdkConfig } from "constants/sdkConfig";
66
import _ from "lodash";
7-
import { createRoot } from "react-dom/client";
7+
import { Root } from "react-dom/client";
88
import { StyleSheetManager } from "styled-components";
99
import { ModuleDSL, ModuleDSLIoInput } from "types/dsl";
1010
import { AppView } from "./AppView";
@@ -40,7 +40,7 @@ export class AppViewInstance<I = any, O = any> {
4040
webUrl: "https://app.lowcoder.cloud",
4141
};
4242

43-
constructor(private appId: string, private node: Element, options: AppViewInstanceOptions = {}) {
43+
constructor(private appId: string, private node: Element, private root: Root, options: AppViewInstanceOptions = {}) {
4444
Object.assign(this.options, options);
4545
if (this.options.baseUrl) {
4646
sdkConfig.baseURL = this.options.baseUrl;
@@ -137,8 +137,7 @@ export class AppViewInstance<I = any, O = any> {
137137

138138
private async render() {
139139
const data = await this.dataPromise;
140-
const root = createRoot(this.node);
141-
root.render(
140+
this.root.render(
142141
<StyleSheetManager target={this.node as HTMLElement}>
143142
<AppView
144143
appId={this.appId}

client/packages/lowcoder/src/appView/bootstrapAt.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { loadComps } from "comps";
22
import { AppViewInstance, AppViewInstanceOptions } from "./AppViewInstance";
3+
import { createRoot } from "react-dom/client";
34

45
loadComps();
56

@@ -12,5 +13,5 @@ export async function bootstrapAppAt<I>(
1213
console.error("node must be not null.");
1314
return;
1415
}
15-
return new AppViewInstance(appId, node, options);
16+
return new AppViewInstance(appId, node, createRoot(node), options);
1617
}

client/packages/lowcoder/src/comps/comps/customComp/customComp.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { EventData, EventTypeEnum } from "./types";
1212
import { hiddenPropertyView } from "comps/utils/propertyUtils";
1313
import { trans } from "i18n";
1414
import { EditorContext } from "comps/editorState";
15-
import * as ReactDOMClient from 'react-dom/client';
1615

1716
// TODO: eventually to embedd in container so we have styling?
1817
// TODO: support different starter templates for different frameworks (react, ANT, Flutter, Angular, etc)
@@ -60,8 +59,7 @@ const defaultCode = `
6059
);
6160
6261
const ConnectedComponent = ${trans("customComp.sdkGlobalVarName")}.connect(MyCustomComponent);
63-
const container = document.getElementById('root');
64-
const root = ReactDOMClient.createRoot(container);
62+
const root = ReactDOM.createRoot(document.getElementById("root"));
6563
root.render(<ConnectedComponent />);
6664
6765
</script>

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,7 @@ export const en = {
25732573
"selectBackground": "Selected Background"
25742574
},
25752575
"componentDocExtra": {
2576-
"table": "Additional Documentation for Table Component"
2576+
table,
25772577
},
25782578
"idSource": {
25792579
"title": "OAuth Providers",

0 commit comments

Comments
 (0)