chirptune
chirptune
Explore posts from servers
SSolidJS
Created by chirptune on 10/26/2024 in #support
How to transform into getters outside of props?
When you pass a prop into a component it is transformed into a getter like <MyProp color={color()}, the props are { get color() { return color() } }. Is there a way to trigger such compile transformation for normal js code, like creating a normal object and transforming it into an object of getters?
3 replies
SSolidJS
Created by chirptune on 9/9/2024 in #support
How to catch all errors but keep rendered component?
In other words, how can I make the child of ErrorBoundary stay rendered and not switch to fallback? Or rather, how I can catch all errors in my solid app?
3 replies
SSolidJS
Created by chirptune on 5/17/2024 in #support
Why is solid start dev site so heavy?
I ran pnpm create solid, picked the basic template, then ran dev to encounter almost 10mb of js being loaded. I'm aware that building will minify, bundle and tree shake most of this, but building takes almost 6 seconds to build an empty app, even when building after a succesful build. Something as equally confusing is that the heaviest resource is 1.5mb of shikiji, a syntax highlighter. I found this issue, maybe related? https://github.com/solidjs/solid-start/issues/1281
4 replies
SSolidJS
Created by chirptune on 5/17/2024 in #support
Is it possible to have a nextjs-style app router?
... where (inside app/) route.ts are API calls and page.ts are pages. Is the intention to not move in that direction to clearly separate API code from client side code?
7 replies
SSolidJS
Created by chirptune on 7/31/2023 in #support
solid devtools fails with O.createRoot is not a function
The extension is version 0.27.5 My deps are:
"solid-devtools": "^0.27.5",
"solid-js": "^1.7.0",
"solid-devtools": "^0.27.5",
"solid-js": "^1.7.0",
Error is:
debugger.ts-92f4bae0.js:1 Uncaught TypeError: O.createRoot is not a function
at Hn (debugger.ts-92f4bae0.js:1:6771)
at debugger.ts-92f4bae0.js:64:12559
debugger.ts-92f4bae0.js:1 Uncaught TypeError: O.createRoot is not a function
at Hn (debugger.ts-92f4bae0.js:1:6771)
at debugger.ts-92f4bae0.js:64:12559
12 replies
SSolidJS
Created by chirptune on 4/11/2023 in #support
How to have reactive getters on each element?
Let's say I have a createStore, and I want each element to have a getter, how should I go about this? I asked chat gpt, and he proposed this.
const [state, setState] = createStore([
{ name: 'John', age: 30 },
{ name: 'Mary', age: 25 },
{ name: 'Bob', age: 40 },
]);

const filteredState = createComputed(() =>
state.map((item) => ({
...item,
get filteredName() {
return item.name.toLowerCase().startsWith(nameFilter().toLowerCase());
},
}))
);
const [state, setState] = createStore([
{ name: 'John', age: 30 },
{ name: 'Mary', age: 25 },
{ name: 'Bob', age: 40 },
]);

const filteredState = createComputed(() =>
state.map((item) => ({
...item,
get filteredName() {
return item.name.toLowerCase().startsWith(nameFilter().toLowerCase());
},
}))
);
I think this looks ok enough, do you guys agree? Is there an alternative that lets you include getters right into the data I pass to createStore?
5 replies