pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

#9354: fix Page Editor lag regression when clicking between mods

Open twschiller opened this issue 1 year ago • 2 comments

What does this PR do?

  • Closes #9354
  • Modifies useRegisterDraftModInstanceOnAllFrames to only check for reinjection on sequence number changes
    • Why? The selected mod component is handled by Formik/Reload Toolbar. The only way for the other mod components to be changed is Redux modifications, which would bump the sequence number
  • Refactors useRegisterDraftModInstanceOnAllFrames to be a thunk. (Avoids calculating selectGetCleanComponentsAndDirtyFormStatesForMod, etc. on every Formik update that's committed)

Discussion

  • On beta.1 build on my M1, the click into a large mod was taking 110ms. Preliminary profiling didn't point out any major bottlenecks - it seems like computation just add up
  • Not sure at what number of mods shifting to a storage format of Record<UUID, ModComponentFormState> would make a measurable/noticeable difference

For more information on our expectations for the PR process, see the code review principles doc

twschiller avatar Oct 25 '24 22:10 twschiller

Playwright test results

passed  141 passed
flaky  3 flaky
skipped  2 skipped

Details

report  Open report ↗︎
stats  146 tests across 47 suites
duration  10 minutes, 50 seconds
commit  5883206
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/modLifecycle.spec.ts › create, run, package, and update mod msedge › tests/pageEditor/brickActions.spec.ts › brick actions panel behavior msedge › tests/runtime/modVariables/variableSync.spec.ts › Mod Variable Sync › session variable cross-tab sync

Skipped tests

chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

github-actions[bot] avatar Oct 25 '24 23:10 github-actions[bot]

Codecov Report

Attention: Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 75.26%. Comparing base (8318d74) to head (5883206). Report is 429 commits behind head on main.

Files with missing lines Patch % Lines
...or/hooks/useRegisterDraftModInstanceOnAllFrames.ts 87.50% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9357      +/-   ##
==========================================
+ Coverage   74.24%   75.26%   +1.01%     
==========================================
  Files        1332     1373      +41     
  Lines       40817    41863    +1046     
  Branches     7634     7773     +139     
==========================================
+ Hits        30306    31509    +1203     
+ Misses      10511    10354     -157     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 25 '24 23:10 codecov[bot]