mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-12-04 05:29:08 +00:00
cherry pick 5b35249
from https://gitee.com/wangchensu1/arkui_ace_engine/pulls/40140
修复builderNode在状态管理V2场景下的更新异常 Signed-off-by: wangchensu <wangchensu@huawei.com> Change-Id: Ic58736bfffdeebbe39fc130dc0696b197141e396
This commit is contained in:
parent
a2988e9674
commit
e39aa06923
@ -272,6 +272,14 @@ class JSBuilderNode extends BaseNode {
|
||||
const updateFunc = (elmtId: number, isFirstRender: boolean): void => {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
// if V2 @Observed/@Track used anywhere in the app (there is no more fine grained criteria),
|
||||
// enable V2 object deep observation
|
||||
// FIXME: A @Component should only use PU or V2 state, but ReactNative dynamic viewer uses both.
|
||||
if (ConfigureStateMgmt.instance.needsV2Observe()) {
|
||||
// FIXME: like in V2 setting bindId_ in ObserveV2 does not work with 'stacked'
|
||||
// update + initial render calls, like in if and ForEach case, convert to stack as well
|
||||
ObserveV2.getObserve().startRecordDependencies(this, elmtId, true);
|
||||
}
|
||||
if (this._supportNestingBuilder) {
|
||||
compilerAssignedUpdateFunc(elmtId, isFirstRender);
|
||||
} else {
|
||||
@ -280,6 +288,9 @@ class JSBuilderNode extends BaseNode {
|
||||
if (!isFirstRender) {
|
||||
_popFunc();
|
||||
}
|
||||
if (ConfigureStateMgmt.instance.needsV2Observe()) {
|
||||
ObserveV2.getObserve().stopRecordDependencies();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
};
|
||||
|
@ -30,6 +30,17 @@ interface UpdateFuncRecord {
|
||||
node?: object;
|
||||
}
|
||||
|
||||
declare class ObserveV2 {
|
||||
static getObserve(): ObserveV2;
|
||||
public stopRecordDependencies(): void;
|
||||
public startRecordDependencies(cmp: BaseNode, id: number, doClearBinding: boolean): void;
|
||||
}
|
||||
|
||||
declare class ConfigureStateMgmt {
|
||||
public static get instance(): ConfigureStateMgmt;
|
||||
public needsV2Observe(): boolean;
|
||||
}
|
||||
|
||||
declare function wrapBuilder<Args extends Object[]>(
|
||||
builder: (...args: Args) => void
|
||||
): WrappedBuilder<Args>;
|
||||
|
@ -291,6 +291,14 @@ class JSBuilderNode extends BaseNode {
|
||||
const updateFunc = (elmtId, isFirstRender) => {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
// if V2 @Observed/@Track used anywhere in the app (there is no more fine grained criteria),
|
||||
// enable V2 object deep observation
|
||||
// FIXME: A @Component should only use PU or V2 state, but ReactNative dynamic viewer uses both.
|
||||
if (ConfigureStateMgmt.instance.needsV2Observe()) {
|
||||
// FIXME: like in V2 setting bindId_ in ObserveV2 does not work with 'stacked'
|
||||
// update + initial render calls, like in if and ForEach case, convert to stack as well
|
||||
ObserveV2.getObserve().startRecordDependencies(this, elmtId, true);
|
||||
}
|
||||
if (this._supportNestingBuilder) {
|
||||
compilerAssignedUpdateFunc(elmtId, isFirstRender);
|
||||
}
|
||||
@ -300,6 +308,9 @@ class JSBuilderNode extends BaseNode {
|
||||
if (!isFirstRender) {
|
||||
_popFunc();
|
||||
}
|
||||
if (ConfigureStateMgmt.instance.needsV2Observe()) {
|
||||
ObserveV2.getObserve().stopRecordDependencies();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user