I have not tried to make a demo yet, I was hoping one existed I could try to work it out from first.
Actually, I tried useLayoutEffect, and whilst it did not work, it may provide a clue.
With useEffect, the pins work fine on initial load. The issue is when i go to / come back from another page it just ignores the pinned scrolltriggers. I notice the markers work as expected. I can see the top marker stay in place, which is met by the element start marker. When i come back to the page, the markers are in the same place but are just ignored.
I noticed with useLayout effect the top marker moves up the page, so the pin never triggers. So that didnt work.
I am using locomotive scroll setup (all works as expected minus this issue). I am suspecting it may be something to do with that setup up rather than gsap specifically.