Hi GreenSock,
To provide context:
I am an amateur developer trying to code a portfolio website (I am a Product Manager). Over the last 5 weeks, I coded the site in TypeScript using Next.js and GSAP.
My problem:
There is a very noticeable site-wide jank/jitter/lag occurring on mobile. I have been debugging it for more than a week. The very strange thing is sometimes I deploy could-be fixes, the lag goes away and I think I solved it finally, and then it comes back some other time (without any new deployments or code changes!).
Things I've tried:
I'm an amateur developer, so it's difficult for me to dive too deep in advanced concepts like browser rendering and memory management. I've been studying the profiler in Chrome DevTools for the past week and I did try the following fixes:
Rewrote many animations that forced layout reflow into transforms (i.e. scale, yPercent, xPercent instead of width, height, top, left)
Removed an x-transform sprite animation from the home page that was based on a 16000x350 368KB PNG. My biggest bet was on this causing the lag, I really did not want to remove it because my website looks too plain without it -> but even removing it didn't help!
Removed a vh hack I was using to subtract the mobile browser address bar height from containers using 'height: 100vh' in CSS (using a globally set root variable with the height of the address bar, then using 'height: calc(var(--vh, 1) * 100)'. I believe this was causing a layout reflow and on elements that were being animated, I believed it might be causing an issue. I removed it, lag was gone, I celebrated, lag came back (no joke - true story).
I am convinced there is a memory leak happening in my code (the only thing I can think of) due to possibly incorrect usage of GSAP with React. My website is fairly small (5 pages), my code is straightforward and well-documented, and I am not doing anything fairly complex.
My request:
Is it possible to get someone to audit my repo, who has knowledge of Next.js/React? So I can exorcise this lag demon from my code. I am willing to pay a fee, of course, I don't expect it to b done for free.
I am sure someone like OSUBlake or Cassie can spot the root issue in minutes. I could really use the tips too, as I plan to continue using a Next.js + GSAP setup for future projects.
Please help me. I am a little crushed/demoralized that I spent 5 weeks coding this, only to be defeated by this ghost on/off lag.
EDIT: Silly me, forgot to include the website. You can check it here: https://mbmg.studio
Steps to Reproduce:
1. Open the website on a mobile browser (Chome/Safari)
2. Navigate to "Resume" section
3. Scroll
4. Observe how the conic-gradient animation is jittery.
5. Scroll further down
6. Observe the rows jumping/jittering while animating
Note that this is not always the case - so this is not an issue of mobile not being able to handle those animations. Those animations used to run super smoothly. There is something else at play here, a "Kaelago" in the code.