decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.84k stars 3.04k forks source link

fix: avoid unnecessary rerenders #7004

Closed spereirag closed 9 months ago

spereirag commented 10 months ago

Summary

My team currently has a fork of decap-cms with several custom plugins, some of them considerably costly in terms of render time. We noticed the render time became unbearably slow when loading a moderately long list (~15 elements) of one of said plugins. After a bit of debugging, we noticed a huge amount of component rerenders while the assets were loading, and the plugin wasn't even visible. The problem is fixed when using the existing prop isLoadingAsset to avoid updating the component while the assets are loading. This PR implements that fix.

Test plan

yarn test runs successfully

Test Suites: 1 skipped, 79 passed, 79 of 80 total
Tests:       652 skipped, 989 passed, 1641 total
Snapshots:   110 passed, 110 total
Time:        79.975 s
Ran all test suites.

Checklist

Please add a x inside each checkbox:

netlify[bot] commented 10 months ago

Deploy request for cms-demo rejected.

Name Link
Latest commit 5b8763b717296bf0be44c6a04c98f1a68370c07b
netlify[bot] commented 10 months ago

Deploy Preview for decap-www canceled.

Name Link
Latest commit 4bb217054a66b2edfe1fee79dcb1fbf8fe19419c
Latest deploy log https://app.netlify.com/sites/decap-www/deploys/6581b5979795cd0007ac3ac1