Replies: 1 comment
|
Thanks for opening up a new discussion. It feels to me like there are two aspects:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi community,
Last year I proposed and improved the main interface for
jotai-aiuseChatfrom upstream jotaijs/jotai-ai#16However, the latest one (jotaijs/jotai-ai#20) has stalled and hasn't seen much progress.
Asides from Alex's interests shifting, I believe another important reason is that Jotai itself currently lacks a built-in mechanism to sync external data source or store efficiently. This often results in one more redundant re-renders.
This basically what
useSyncExternalStoresolves. But we know that Jotai doesn't useuseSyncExternalStoreinternally, since it doesn't support time slicing. So, solving re-render issue within my PR felt out of scope.I originally considered seeking help with upstream or submitting a temporary workaround inspired
atomWithObserverand recoil'ssyncEffect, but I couldn't find the time to finalize it. Despite that, I've been still closely following the news and progress of Jotai. Like recently, Naman created a PoC project gh:nmn/react-concurrent-jotai to explore Jotai style atoms in React 19.In #3351, Dashi introduced a new API called
useAtomSyncValwhich leveragesuseSyncExternalStoreinternally. This is sufficient to address the tearing and redundant re-rendering issues. However, as a tradeoff, it cannot take full advantage of concurrent rendering features, which are one of Jotai's most brilliant core principles.As Dashi has clarified new features and breaking changes are not the scope of Jotai v3.0. So I'd love to discuss the possibility of addressing these sync problems in Jotai v3.x or v4. And I'm interested if the new features introduced in React 19 will help to resolve the time slicing issue when syncing with external sources.
Other related discussions
Love to hear your voices!
Regards,
Lanqing
All reactions