webstrand
webstrand
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
downside is: this secretly still does extra work, unlike the exception which terminates the potentially expensive update
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
solid might have a better hook than queueMicrotask, to wait for the last tick before checking to make sure it was disposed of
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
if it's the latter then something like
if (!s.untrack(condition)) {
let cleanedUp = false;
queueMicrotask(() => { if(!cleanedUp) throw new Error("USE AFTER FREE")})
s.onCleanup(() => cleanedUp = true);
}
if (!s.untrack(condition)) {
let cleanedUp = false;
queueMicrotask(() => { if(!cleanedUp) throw new Error("USE AFTER FREE")})
s.onCleanup(() => cleanedUp = true);
}
(this doesn't work, actually causes an infinite loop in my code) suppresses the error in this case
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
I'm not sure if this is a scheduling bug, in the reactive system itself, or if its an issue with Show
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
or maybe <Show>'s condition and conditionValue get updated, then, since the child of the inner <List> is listening to the same signal that caused condition to update, it gets to update, too. When it reads from the stale accessor, it sees the updated value of condition and an exception gets thrown
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
This appears to be caused by the ordering of memo updates and destruction. createMemos listeners are not deferred and run immediately, even if those listeners are owned by another createMemo that will destroy them just as soon as it gets time to run
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
in that stale signal reads should not be an exception
17 replies
SSolidJS
Created by webstrand on 4/21/2025 in #support
Stale read in <List><Show><List>
Well I'm starting to think this is actually a bug in <Show>
17 replies
SSolidJS
Created by lemonad on 4/21/2025 in #support
Untrack on store arrays
it sounds like you really want unwrap instead? To suppress the deep reactivity
4 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
I see what you mean about latest, I'm not sure that's fixable given the api createResource offers
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
I'm pretty sure this is safe
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
it discards them,
createComputed(() => console.log("saw handle", handle1.state === "ready" && handle1()))
createComputed(() => console.log("saw handle", handle1.state === "ready" && handle1()))
doesn't report observing any intermediate values produced by fetches that were refetched while running
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
I assumed it discarded it, because I can't imagine otherwise
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
that's true, I need to check that createResource discards the result of the promise, if it's already refetching
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
found a better solution (aside from the refetch bug)
const [handle1, ctrl1] = createResource(ref, async (arg) => {
const task = allocate(arg);
onCleanup(() => task.then(value => console.log("cleanup", value)));
return await task;
});
const [handle1, ctrl1] = createResource(ref, async (arg) => {
const task = allocate(arg);
onCleanup(() => task.then(value => console.log("cleanup", value)));
return await task;
});
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
70 replies
SSolidJS
Created by webstrand on 2/16/2025 in #support
How to onCleanup an async resource from createResource?
ah that's helpful, thanks
70 replies