TruongNH Posted November 12, 2023 Share Posted November 12, 2023 Hi, I have some trouble with my Observer. I used it to snap between 2 sections. I have a state for the open menu is isOpenedMenu and pass it to the navbar as props. But when I click many times it causes an error with the Observer. I'm going crazy over this because when stated in the navbar component it works normally. What's wrong with the Observer? Here is my codesanbox: Maximum call stack size exceeded by observer - CodeSandbox Please support me, Thank you so much Link to comment Share on other sites More sharing options...
Solution GreenSock Posted November 12, 2023 Solution Share Posted November 12, 2023 Ah, it looks like this exposed an odd condition where if you call gsap.registerPlugin(Observer) multiple times, it could throw an error. That should be fixed in the next release, but it's easy to work around in your demo by just making sure you only call it once - right now you've got it inside your App() function so just put it outside of that so it doesn't get called every time that component re-renders: https://codesandbox.io/s/maximum-call-stack-size-exceeded-by-observer-forked-mm68pn?file=/src/App.js Better? Link to comment Share on other sites More sharing options...
TruongNH Posted November 14, 2023 Author Share Posted November 14, 2023 On 11/13/2023 at 4:36 AM, GreenSock said: Ah, it looks like this exposed an odd condition where if you call gsap.registerPlugin(Observer) multiple times, it could throw an error. That should be fixed in the next release, but it's easy to work around in your demo by just making sure you only call it once - right now you've got it inside your App() function so just put it outside of that so it doesn't get called every time that component re-renders: https://codesandbox.io/s/maximum-call-stack-size-exceeded-by-observer-forked-mm68pn?file=/src/App.js Better? I got it. Now it's better. Thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now