fix(webapp): remove Spline 3D animation to reduce bundle size by ~47% #2763
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed the dashboard takes a while(20-30seconds) to load sometimes and that led me investigate the reason. I found out one of the JS chunks is 2035kb, which is almost half of the whole JS chunks.
That chunk is three.js library. Which is a dependency for
@splinetool/react-spline, which is only being used to render a spline scene on the error page.As a user, I prefer to have a fast loading dashboard instead of a fancy 3D animation on an error page. Though, same/similar animation can be achieved via lottie or as css animation probably, which will have much smaller size.
This change basically reduces JS bundle size from 4283kb to 2248kb. Even though the assets are being cached I get this slow loading dashboard several times per day. I find that a bit poor UX.
Further optimization is possible by implementing tree shaking to companyicons to bundle only used icons to the build instead of all the icons. That would probably cut another ~600kb since webapp is using only 5 icons from there but loading whole 748kb.
Also noticed the assets are being served without gzip on production, which would improve the situation if you want to keep the animation.
I'm noticing this issue since currently I'm in Türkiye and have a high latency to US-East. Probably a CDN would help a lot too!
✅ Checklist
Testing
Ran locally and went to a 404 page.
Changelog
fix(webapp): remove Spline 3D animation to reduce bundle size
Screenshots
Before
After
Resources
💯