fixie-ai / ai-jsx

The AI Application Framework for Javascript
https://docs.ai-jsx.com
MIT License
1.06k stars 77 forks source link

Rewrite use-fixie hook #363

Closed NickHeiner closed 1 year ago

NickHeiner commented 1 year ago

Previously, all state lived in the useFixie hook. This was bad, because if the calling component unmounted, all the state would be lost. This led to flickering and an inability to reliably cache.

To solve this, we do the same thing libraries like react-query or Apollo do: have state live outside the hook itself. This allows the hook to simply be a shim to the React lifecycle.

This also provides an opening for other frameworks to integrate.

I'm completely confident this is an improvement in correctness over what we have today. There may be some minor issues, but there are also some backend issues right now, so it's a little hard to tell. I'm going to land this and we can keep testing with it.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai-jsx-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 11:04pm
ai-jsx-nextjs-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 11:04pm
ai-jsx-tutorial-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 11:04pm