3070 💯
no data caching between page navigations
multiple API calls in sequence (waterfall)
no loading state management during transitions
no data prefetching
however, the real problem with the noticeable lag/delay navigating to a different page was none of the above issues; it was more to do with React and the mounting/unmounting that is being done as state changes in the child component and I am returning a different DOM sub-tree from there
Eager Data Loading (moved prefetching to root layout for earlier loading)
Smooth Transitions (framer-motion)
navigating to other pages fine but root page still lags like crazy
things i tried
dynamic import components using fdk
wrapping a whole component in Suspense instead of just a part of the component's DOM
fiddling with the useEffect in FrameProvider that loads the context
the thing that was causing the issue for me was using the exported useFrame hook in components that needed Farcaster context data
every time I would use this
useFrame
hook in a component, it would create all these additional states but I'm not sure if that's the intended behaviour or usage of this hook?
this way, we're just keeping one instance of the frame context state and using the useFrameContext in any component that needs the data; this will not trigger the useEffects in the useFrame hook
so, the question is, is there an anti-pattern in the Farcaster Mini App quick start CLI command a.k.a npm create @farcaster/mini-app ???
p.s. the zoink repo was created using the neynar quick start CLI command tbf; @neynar/create-farcaster-mini-app
Excited to share insights from the latest blog post! It dives into performance issues within Zoink, tackling data caching, API call sequences, and the impact of React’s mounting behavior. Optimizations like eager data loading and suspended components catapult performance. Check it out from @3070.eth!