alloyed
alloyed
SSolidJS
Created by Liquido on 12/1/2023 in #support
How to make SolidJS tags not return HTML elements for a custom renderer?
i would also maybe consider writing your renderer to extend solid/web's interface, maybe? eg. if the input tag is the name of an existing dom object, forward to html, otherwise forward to your custom logic
12 replies
SSolidJS
Created by Liquido on 12/1/2023 in #support
How to make SolidJS tags not return HTML elements for a custom renderer?
you could use the @jsxImportSource pragma to override things on a per file basis. https://www.typescriptlang.org/tsconfig#jsxImportSource but I'm not sure the solid plugin itself would respect it? I guess instead you could install two copies of the solid plugin with different include patterns: https://github.com/solidjs/vite-plugin-solid/blob/7e667ad0bb05ba55e0a4a3e185ecc7e3e3535e4f/src/index.ts#L29C24-L29C24
12 replies
SSolidJS
Created by alloyed on 11/27/2023 in #support
implementation detail: enableScheduling uses MessageChannel API?
ok notes for future spelunkers. MessageChannel is used in the body of this function and nowhere else: https://github.com/solidjs/solid/blob/460068202bbd7a56a14664ac14fa7efb900d8194/packages/solid/src/reactive/scheduler.ts#L29 The solidjs tests replace it with a do-nearly-nothing polyfill that using setTimeout instead: https://github.com/solidjs/solid/blob/460068202bbd7a56a14664ac14fa7efb900d8194/packages/solid/test/MessageChannel.ts#L1C1-L9C3 The purpose of this piece of code is to schedule work to be done at a future time. Using setTimeout means it'll happen in the next frame's update loop, I don't know exactly what MessageChannel does but it's probably something similar. queueMicrotask() would be a bad idea, it'd just do everything in a single frame, and requestIdleCallback() would probably result in a very laggy experience. The scheduler uses 'navigator.scheduling.isInputPending' to detect if it should yield to existing user input: https://developer.mozilla.org/en-US/docs/Web/API/Scheduling/isInputPending https://github.com/solidjs/solid/blob/460068202bbd7a56a14664ac14fa7efb900d8194/packages/solid/src/reactive/scheduler.ts#L68 if it doesn't detect any user input, it will attempt to run for as long as possible, up to the maxYieldInterval (300ms). If you don't implement isInputPending, it will assume that there's always input pending and yield after the the yieldInterval, 5ms. All of this is user-customizable by providing a custom implementation of requestCallback to enableScheduling.
10 replies
SSolidJS
Created by alloyed on 11/27/2023 in #support
implementation detail: enableScheduling uses MessageChannel API?
so any web-specific API i need to polyfill, but we don't have things like iframes to worry about
10 replies
SSolidJS
Created by alloyed on 11/27/2023 in #support
implementation detail: enableScheduling uses MessageChannel API?
Proprietary embedded context! It's not react native, but the broad strokes are super similar
10 replies
SSolidJS
Created by alloyed on 11/27/2023 in #support
implementation detail: enableScheduling uses MessageChannel API?
I'll just drop in an undefined variable here
10 replies
SSolidJS
Created by alloyed on 11/27/2023 in #support
implementation detail: enableScheduling uses MessageChannel API?
No description
10 replies
SSolidJS
Created by alloyed on 11/27/2023 in #support
implementation detail: enableScheduling uses MessageChannel API?
another web-specific API:
10 replies
SSolidJS
Created by alloyed on 11/20/2023 in #support
1. arguments to useTransition() 2. measuring async updates
gotcha, so the answer to #1 is "the type signature is right the docs are wrong", cool
5 replies
SSolidJS
Created by alloyed on 11/20/2023 in #support
1. arguments to useTransition() 2. measuring async updates
startTransition no longer takes callback as a second argument

Instead it returns a promise you can await. This works better for chaining sequences of actions.

const [start, isPending] = useTransition();

start(() => doSomething()).then(() => allDone());
startTransition no longer takes callback as a second argument

Instead it returns a promise you can await. This works better for chaining sequences of actions.

const [start, isPending] = useTransition();

start(() => doSomething()).then(() => allDone());
5 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
the way this actually is breaking down i think i just a loop between the key we use to query the data and the data itself somewhere, but if there's a less error-prone way of doing the same thing I'd rather do that ofc
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
so this isn't a repro but it gives a good vibe for what's actually going on. createRemoteDataStoreSignal is the thing I swapped with a render effect. If this screams to you "this should be a resource", that's because it did for me too! but the promise-based nature of resources make it bad for subscription-based APIs like this. I at least wanted to get the signal-only version working before playing with weird stuff like a promise that never completes or something like that
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
thank you~
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
okok, back from investigating! the approach that was the most fruitful was dropping console.log() calls right at the top of each createEffect() or set() call that i suspected could've been an issue. the ones in the loop then megaspammed, which made it easy to pinpoint. unfortunately for me, it's in highly generic library code so I've got more investigating to do on my end. Right now, swapping the offending effect for createRenderEffect() seems to make the problem go away, but that isn't really a solution, so back into the debugging mines for me.
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
I can just go caveman mode and start throwing console.log()s at the start of every effect
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
happens at startup; this is the first time I've tried to run it after porting; the mistake could be anywhere in my ported code
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
cause that'd make sense, i guess the clue for that would be at the very bottom of the stack tho
15 replies
SSolidJS
Created by alloyed on 11/15/2023 in #support
stack overflow internal to solidjs?
the problem being "reading and writing to the same signal in a single effect"? or so
15 replies
SSolidJS
Created by alloyed on 10/30/2023 in #support
encapsulating logic that uses refs?
doing the inline callback thing vs making a full signal is just a matter of preference I think, the signal itself won't ever change after initial mount
12 replies