Comments (3)
Nice catch.
Hm, I naively thought about delaying like this,
diff --git a/src/vanilla/store.ts b/src/vanilla/store.ts
index fa7e7fb..e84a632 100644
--- a/src/vanilla/store.ts
+++ b/src/vanilla/store.ts
@@ -562,9 +562,11 @@ export const createStore = () => {
const result = writeAtomState(atom, ...args)
const flushed = flushPending()
if (import.meta.env?.MODE !== 'production') {
+ Promise.resolve().then(() => {
storeListenersRev2.forEach((l) =>
l({ type: 'write', flushed: flushed as Set<AnyAtom> })
)
+ })
}
return result
}
but maybe we should do it in useAtomsDebugValue
?
from jotai.
LGTM, btw is queueMicroTask
better?
from jotai.
Well, our build still targets IE 11,
Line 96 in 247d9b1
even though, it may not work perfectly.
queueMicroTaks doesn't seem available: https://caniuse.com/mdn-api_queuemicrotask
but maybe we should do it in useAtomsDebugValue?
I don't think we should add a delay in Jotai, because there are some use cases for sync behavior.
Can you open a PR in jotai-devtools
?
from jotai.
Related Issues (20)
- atomWithStorage issue since 2.3.0+ HOT 3
- Derived dependent atoms not updating during multiple sets HOT 8
- Type Error while using useHydrateAtoms HOT 1
- Jotai async atom not working with expo-router HOT 18
- When working with async atoms in TypeScript, cannot import `Loadable` type from `utils` HOT 4
- Can atomFamily add a cache strategy?
- jotai-recoil issue since 2.3.0+ HOT 15
- onMount cleanup method is called right after mount on React dev mode due to react 18
- `loadable` seems to tear
- react-refresh-plugin crashes if createStorage is even referenced in a file running on expo web HOT 1
- Cann't access `atomWithStorage` value in spa initial HOT 14
- (nextjs) - useHydrateAtoms return previous value on dynamic route
- Document the use of a function as the second parameter of `set` HOT 2
- Vite 5 / Rollup 4 build warning in v2.6.0 HOT 14
- "TypeError: Invalid value used as weak map key" when using helper function to create atoms.
- How do I use jotai in ordinary js files?not function component.
- [React Native] Atom updates that occur within setTimeout/setInterval trigger a re-render for every useAtom instance HOT 1
- mount is executed twice HOT 2
- Bad lingature for coding font on doc page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jotai.