alloyed
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
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-L29C2412 replies
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
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
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 that15 replies
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