Replies: 3 comments
-
Same question here. Expected behavior is the same as mobx.computed, but I'm getting these really expensive computations on init because it's not lazy. |
Beta Was this translation helpful? Give feedback.
0 replies
-
So I've just done this custom lazyMemo:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Just what I was looking at the time. I created Solid back in 2016 and was inspired heavily by S.js which was all eager. Changing to lazy would have been breaking. But it will be lazy in 2.0. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I realized that
createMemo
is not lazy - it calls callback as soon ascreateMemo
defined. This leads to several inconsistensesCurrent state of view might not need actual value of that memo, so computation could be defer:
In this example we do not need memoizedValue, until
otherFlag()
is set.Second example is about messing with Suspenses, I extracted to playground https://playground.solidjs.com/anonymous/81480f12-9cf2-46b2-8a1e-4f98917b74d2
tldr: using
createMemo
could implicitly trigger resource to load, resulting in triggering unexpected Suspense boundaryWhat is the reason for making
createMemo
eager instead of lazy?Beta Was this translation helpful? Give feedback.
All reactions