Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix apps re-rendering issue with SDK#648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall 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: 4 additions & 1 deletionclient/packages/lowcoder-sdk/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import { useRef } from "react";
import ReactDOM, { flushSync } from "react-dom";
import { createRoot } from "react-dom/client";
import { AppViewInstance, bootstrapAppAt, LowcoderAppView } from "./src/index";

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

// React
ReactDOM.render(<ReactDemoApp />, document.querySelector("#app2"));
const container = document.querySelector("#app2");
const root = createRoot(container!);
root.render(<ReactDemoApp />);
}

bootstrap();
2 changes: 1 addition & 1 deletionclient/packages/lowcoder-sdk/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-sdk",
"version": "2.3.0",
"version": "2.3.1",
"type": "module",
"files": [
"src",
Expand Down
7 changes: 3 additions & 4 deletionsclient/packages/lowcoder/src/appView/AppViewInstance.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ import { RootComp } from "comps/comps/rootComp";
import { setGlobalSettings } from "comps/utils/globalSettings";
import { sdkConfig } from "constants/sdkConfig";
import _ from "lodash";
import {createRoot } from "react-dom/client";
import {Root } from "react-dom/client";
import { StyleSheetManager } from "styled-components";
import { ModuleDSL, ModuleDSLIoInput } from "types/dsl";
import { AppView } from "./AppView";
Expand DownExpand Up@@ -40,7 +40,7 @@ export class AppViewInstance<I = any, O = any> {
webUrl: "https://app.lowcoder.cloud",
};

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

private async render() {
const data = await this.dataPromise;
const root = createRoot(this.node);
root.render(
this.root.render(
<StyleSheetManager target={this.node as HTMLElement}>
<AppView
appId={this.appId}
Expand Down
3 changes: 2 additions & 1 deletionclient/packages/lowcoder/src/appView/bootstrapAt.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import { loadComps } from "comps";
import { AppViewInstance, AppViewInstanceOptions } from "./AppViewInstance";
import { createRoot } from "react-dom/client";

loadComps();

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

[8]ページ先頭

©2009-2025 Movatter.jp