Alex Lohr
Alex Lohr
SSolidJS
Created by quinnvaughn on 1/14/2025 in #support
How to share async data inside a context
The problem here is the const currentPlan = query.plans[0], which takes the data out of the proxy that tracks reactive changes. The solution is to return a function instead of a value: const currentPlan = () => query.plans[0].
6 replies
SSolidJS
Created by JonathanExcelsior on 1/12/2025 in #support
createSignal vs createStore
That's what I said: try to split up state into multiple signals. Ofc, there may also be the case where a state object changes rarely but the expected changes are large enough to warrant a full re-render in any case. Do not waste time to optimize reactivity that is already sufficiently performant.
6 replies
SSolidJS
Created by JonathanExcelsior on 1/12/2025 in #support
createSignal vs createStore
Thanks.
6 replies
SSolidJS
Created by JonathanExcelsior on 1/12/2025 in #support
createSignal vs createStore
6 replies
SSolidJS
Created by Mia on 12/19/2024 in #support
How do I manually implement hydration for a component?
<Hydration>...</Hydration> and <NoHydration></NoHydration> are currently undocumented features AFAIK.
3 replies
SSolidJS
Created by Mirardes on 12/19/2024 in #support
Need help to convice developers to go to SolidJS
Look at a component. How many parts of that code actually need to run again and again every time the state changes? I would say less than 25% in most cases. With React, you usually try to minimize the time spent on this by cutting smaller components, otherwise you get performance issues easily. With Solid, you know that static parts will be rendered once and never touched again until cleanup. Instead of running component functions again, we only run the parts where changes occur. However, this means the underlying mindset is completely different. We do not have hook rules since we do not rely on ref counting, but we have props proxies, so we cannot destructure props, lest we lose their reactivity. In React, useState, useMemo and useEffects are trap doors out of re-running code, whlie in Solid, it is the opposite. Also, we can actually manage state pretty efficiently without external libraries.
9 replies
SSolidJS
Created by slainless on 12/10/2024 in #support
How to improve list rendering performance?
Even if you used a memo, the object equality comparison would trigger on a new array. So the solution would be a pattern like
let unchanged = true, previouslyFiltered = [], previousMatched;
const matched = strings.filter((str, i) => {
const filtered = exclude(str);
unchanged = unchanged && previouslyFiltered[i] === filtered;
previouslyFiltered[i] = filtered;
return filtered;
});
const result = unchanged ? previousMatched : matched;
previousMatched = matched;
return result;
let unchanged = true, previouslyFiltered = [], previousMatched;
const matched = strings.filter((str, i) => {
const filtered = exclude(str);
unchanged = unchanged && previouslyFiltered[i] === filtered;
previouslyFiltered[i] = filtered;
return filtered;
});
const result = unchanged ? previousMatched : matched;
previousMatched = matched;
return result;
11 replies
SSolidJS
Created by walid on 7/30/2023 in #support
SWC Support for SolidJS
One would have to map one AST format to another, which is a bother.
30 replies
SSolidJS
Created by Eatham on 11/25/2024 in #support
Use an action for a form but stay on the same page?
Even if you post a request, the site usually changes to the URL in the action, showing the reply of a POST response.
5 replies
SSolidJS
Created by Eatham on 11/25/2024 in #support
Use an action for a form but stay on the same page?
You either need the page that controls the action to go back to the previous page or to send the form through JS (or both).
5 replies
SSolidJS
Created by walid on 7/30/2023 in #support
SWC Support for SolidJS
Maybe such a solution will be part of https://oxc.rs/ at some point.
30 replies
SSolidJS
Created by walid on 7/30/2023 in #support
SWC Support for SolidJS
I think the solution will be something like using porffor to transpile plugin transformers into wasm to run them in a performant way directly from the rust code.
30 replies
SSolidJS
Created by walid on 7/30/2023 in #support
SWC Support for SolidJS
And context will also not work.
30 replies
SSolidJS
Created by walid on 7/30/2023 in #support
SWC Support for SolidJS
That is due to solid-js/h supports react-style JSX transforms, but does not create the reactive effects for props changes, so you need to do them manually.
30 replies
SSolidJS
Created by narmia on 6/22/2023 in #support
Anyone one have any insight on how to integrate a Meta/FB Pixel with a SolidStart site?
declare global {
interface Window {
fbq: [insert type here];
}
}
declare global {
interface Window {
fbq: [insert type here];
}
}
14 replies
SSolidJS
Created by Massukka on 10/16/2024 in #support
&& in <Show> when condition and typescript?
27 replies
SSolidJS
Created by Massukka on 10/16/2024 in #support
&& in <Show> when condition and typescript?
Right, I wanted to extend the type to be more precise, that's a leftover.
27 replies
SSolidJS
Created by Massukka on 10/16/2024 in #support
&& in <Show> when condition and typescript?
27 replies
SSolidJS
Created by Massukka on 10/16/2024 in #support
&& in <Show> when condition and typescript?
I think we should at least add a line to document this behavior.
27 replies
SSolidJS
Created by Massukka on 10/16/2024 in #support
&& in <Show> when condition and typescript?
It seems you are indeed correct. We need to fix the docs!
27 replies