HuolalaTech / page-spy-web

Debug remotely and easily like chrome devtools.
https://www.pagespy.org
MIT License
4.28k stars 257 forks source link

Optimize: state transient updates in zustand store #138

Closed wqcstrong closed 7 months ago

wqcstrong commented 7 months ago

对于复杂应用,ConsoleNetwork 面板的状态更新的频率通常非常高,而且状态数量伴随着调试时长会越来越多。针对这个问题,这个变更里将有必要优化的状态都通过 useRef() 保存、并通过 useXXXStore.subscribe() 更新,同时新增了 useForceThrottleRender 保证状态能正确渲染到页面上。

Due to the frequent updates of the Console and Network panels, and the increasing number of states with the duration of debugging, it becomes necessary to optimize. To address this issue, I have utilized useRef() to store states that require optimization and updated them through useXXXStore.subscribe(). Additionally, I have introduced useThrottleForceRender to ensure that the states are correctly rendered on the page.