HarmonyOS WaterFlow滚动到中间重构Sections导致组件异常重复渲染

WaterFlow滚动到中间重构Sections导致组件异常重复渲染。操作步骤如下:

1、将waterFlow滑动到双列流位置。

2、刷新商品触发waterFlow的Sections被重建。

3、屏幕外的FlowItem疯狂刷新。

4、最后导致主线程卡死,内存溢出crash日志如下:

Error message: OutOfMemory when trying to allocate 10223616 bytes function name:  OldSpace::Merge
Stacktrace:
  at ObservedPropertyAbstract (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:2771:1)
at ObservedPropertyAbstractPU (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:4590:1)
at SynchedPropertyTwoWayPU (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:5748:1)
at factory (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6624:1)
at createSync (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:2886:1)
at initializeConsume (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6629:1)
at DetailDXComponent (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/components/DXComponent.ets:32:24)
at anonymous (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/component-builder/DinamicXBuilder.ets:34:19)
at updateFunc (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6722:1)
at observeComponentCreation2 (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6763:1)
at buildDinamicXWithLinkObj (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/component-builder/DinamicXBuilder.ets:34:19)
at anonymous (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/components/waterFlow/WaterFlowItem.ets:52:11)
at ifElseBranchUpdateFunction (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:4285:1)
at anonymous (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/components/waterFlow/WaterFlowItem.ets:51:16)
at updateFunc (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6722:1)
at observeComponentCreation2 (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6763:1)
at anonymous (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/components/waterFlow/WaterFlowItem.ets:48:72)
at ifElseBranchUpdateFunction (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:4285:1)
at anonymous (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/components/waterFlow/WaterFlowItem.ets:48:72)
at updateFunc (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6722:1)
at observeComponentCreation2 (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6763:1)
at initialRender (oh_modules/.ohpm/@xxx-ohos+detail_platform@1.0.120-SNAPSHOT/oh_modules/@xxx-ohos/detail_platform/src/main/ets/components/waterFlow/WaterFlowItem.ets:73:30)
at initialRenderView (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6419:1)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
HarmonyOS
2025-01-09 17:17:12
1212浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

需要保证LazyForEach下每一个FlowItem的key唯一性,不能重复。如果reload了所有FlowItem的数据,希望新旧数据的key可以重复,组件不重建只刷新UI,可以使用ObjectLink只更新组件中的数据。

分享
微博
QQ
微信
回复
2025-01-09 19:34:08


相关问题
HarmonyOS List组件默认滚动到最底部
1204浏览 • 1回复 待解决
list组件无法滚动到底部
2330浏览 • 1回复 待解决
Web组件怎么知道滚动到顶部了
1362浏览 • 1回复 待解决
HarmonyOS swiper如何滚动到任意页面?
1124浏览 • 1回复 待解决
怎么判断webview滚动到最下方?
973浏览 • 2回复 待解决
HarmonyOS List列表滚动到指定位置
1210浏览 • 1回复 待解决
HarmonyOS list如何动态滚动到指定位置
872浏览 • 1回复 待解决
HarmonyOS flutter engine特定字符渲染异常
626浏览 • 1回复 待解决