40 Replies
also note the last
saved
state was true
and the calculation always return false
whenever jsonData
changes, therfore the effect should rerun bc false !== true
bump! btw forgot to mention createWritableMemo
is from @solid-primitives/memo
what is setting
saved
to true?inside of
initJsonData
so saved is always being set to true?
only the one time the
initJsonData
is ranand there is no way for whatever is setting saved to true to happen again?
the only way saved is set to true after this is if the prompts to "save" or "save as"
right but doesn't
initJsonData
rerun based on the console logs in your screenshot? Could it be setting it to true again?but the thing im so confused about is
1.
jsonData
is loading (undefined
)
2. saved
memo is run and set to false
3. side effect for save
is ran
4. initJsonData
sets saved
to true
5. side effect for save
is ran
6. jsonData
is updated to the initialised value returned by initJsonData
7. saved
memo is ran (proven by print log) and is supposed to be set to false
8. side effect for saved
is not ran....🤔🤷♂️ It seems like
jsonData
is being updated more than twice
which presumably could mean that initJsonData
could be running more than twice
and it could be setting saved
to true againoh yes it is bc i updated it purposly to see if
save
would update, which i dint
but the update was done using mutate
not refetch
the last update to be clearupdate saved
is being logged twice after saved
is set to true which seems odd. I think the issue could be setting the signal/memo in an async contextalso think that setting
saved
to true before the return caused the problem, bc dont forget the memo reruns when jsonData
is updated
but the confusing part is why isnt the following side effect running after the return jsonData
????
log
meaning saved
updated, but this side effect is unresponsive?reactivity gets weird with async stuff. Afaik reactivity after an
await
call can break stuff, but I'm not 100% sure on that
if you log inside of `initJsonData
, how many times is it runonce, as expected
for testing, try to setSaved before any of your await's in
initJsonData
ReferenceError, assuming its for
setSaved
probably
i assume something like this might work instead 🤔
or just make
saved
always derive true or falsewdym?
also with this i still dont get a side effect after
saved
is ran after updating jsonData
(after its been initialised already)
true !== false
why tf is this not responding...
@REEEEE do think this is a problem with createWritableMemo
and how im always returning false
?What values are passed to the function in the memo?
Could you log
args
to keep it simple i used the callback without
on
Hmm not too sure, could you make a reproduction in the playground and I can take a look
ok
btw, unrelated bu how do i make the libs i import in solid playground have types....
afaik it's not possible yet
the lib is added to the import map
dang
so apparently
saved
refuses to update in this
https://playground.solidjs.com/anonymous/0cdb8878-4a56-47a2-9b31-2bf6ceb65eabSolid Playground
Quickly discover what the solid compiler will generate from your JSX template
that's really weird
ye... im honestly lost
Might be an issue with
createWritableMemo
Not sure what's happening but I copy pasted the
createWritableMemo
code into the playground and it seems to work now...
https://playground.solidjs.com/anonymous/6cc41b34-caa6-4f9f-9e9d-512de0ee8c6bSolid Playground
Quickly discover what the solid compiler will generate from your JSX template
There was an issue with
createWritableMemo
https://github.com/solidjs-community/solid-primitives/issues/633 but it's resolved, so maybe you don't have latest version?GitHub
createWritableMemo()
cannot be set to the same value twice in a r...Describe the bug Given distinct values A and B, when the value of the writable memo is set to A, later computes as B, and then is set to A again, the writable memo holds value B, even though it sho...
Yeah so that's weird, playground even though having newest version works differently than just copied code. And checked that it isn't about the issue above
So
createWritableMemo
just doesn't work at all in playground
https://playground.solidjs.com/anonymous/ccb67468-0581-4d36-a7c9-0ee5cbac4e4aSolid Playground
Quickly discover what the solid compiler will generate from your JSX template
i do infact have the latest version....
something strage is going on with this function
wtaf is going on
https://codesandbox.io/p/devbox/silly-rgb-ygt2th
take a look ^
the inverse
that's really weird. I'll check it locally later
as suggested https://discord.com/channels/722131463138705510/958428791124951050/1269900932259381290 maybe these two sandboxes take different priorities in packages if duplication of dependencies is the case
i think i will opt for the something like this for now ig:
Maybe you could also :