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

Commit9003007

Browse files
fixed global data variables lost while navigating apps
1 parenta59626b commit9003007

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

‎client/packages/lowcoder/src/comps/generators/hookToComp.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function hookToComp(useHookFn: () => JSONObject) {
1313
}),
1414
(comp)=>{
1515
consthookValue=useHookFn();
16+
1617
useEffect(()=>{
1718
comp.children.value.dispatchChangeValueAction(hookValue);
1819
},[hookValue]);
@@ -33,8 +34,10 @@ export function hookToStateComp(useHookFn: () => JSONObject) {
3334
(comp)=>{
3435
consthookValue=useHookFn();
3536
useEffect(()=>{
36-
comp.children.stateValue.dispatchChangeValueAction(hookValue);
37-
},[hookValue]);
37+
if(hookValue!==comp.children.stateValue.getView()){
38+
comp.children.stateValue.dispatchChangeValueAction(hookValue);
39+
}
40+
},[]);
3841
returnnull;
3942
}
4043
);

‎client/packages/lowcoder/src/pages/editor/appEditorInternal.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function useSaveComp(
4444
constdispatch=useDispatch();
4545
const[prevComp,setPrevComp]=useState<Comp>();
4646
const[prevJsonStr,setPrevJsonStr]=useState<string>();
47+
const[prevAppId,setPrevAppId]=useState<string>();
4748

4849
useEffect(()=>{
4950
if(readOnly||blockEditing){
@@ -54,7 +55,7 @@ function useSaveComp(
5455
}
5556
constcurJson=comp.toJsonValue();
5657
constcurJsonStr=JSON.stringify(curJson);
57-
if(prevJsonStr===curJsonStr){
58+
if(prevJsonStr===curJsonStr||(Boolean(prevAppId)&&prevAppId!==applicationId)){
5859
return;
5960
}
6061
// the first time is a normal change, the latter is the manual update
@@ -70,7 +71,8 @@ function useSaveComp(
7071
}
7172
setPrevComp(comp);
7273
setPrevJsonStr(curJsonStr);
73-
},[comp,applicationId,prevComp,prevJsonStr,readOnly,dispatch]);
74+
setPrevAppId(applicationId);
75+
},[comp,prevAppId,applicationId,prevComp,prevJsonStr,readOnly,dispatch]);
7476
}
7577

7678
interfaceAppEditorInternalViewProps{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp