Ciantic
Ciantic
Explore posts from servers
SSolidJS
Created by Ciantic on 10/22/2024 in #support
H3Error: Cannot find module 'bun:sqlite' imported from
Same code works just fine with better-sqlite3 File has "use server" at start, so how it tries to find it seems to be important?
4 replies
SSolidJS
Created by Ciantic on 10/20/2024 in #support
How to get 'client side' createResource behavior in SolidStart?
I noticed that if I don't have Suspense component in SolidStart, the whole page refreshes and createResource loading state doesn't render at all. For example if use this snippet from regular docs in solidstart project:
import { createSignal, createResource, Switch, Match, Show } from "solid-js";

const fetchUser = async (id) =>
{
const response = await fetch(`https://swapi.dev/api/people/${id}/`);
return response.json();
}

function App() {
const [userId, setUserId] = createSignal();
const [user] = createResource(userId, fetchUser);

return (
<div>
<input
type="number"
min="1"
placeholder="Enter Numeric Id"
onInput={(e) => setUserId(e.currentTarget.value)}
/>
<Show when={user.loading}>
<p>Loading...</p>
</Show>
<Switch>
<Match when={user.error}>
<span>Error: {user.error}</span>
</Match>
<Match when={user()}>
<div>{JSON.stringify(user())}</div>
</Match>
</Switch>

</div>
);
}
import { createSignal, createResource, Switch, Match, Show } from "solid-js";

const fetchUser = async (id) =>
{
const response = await fetch(`https://swapi.dev/api/people/${id}/`);
return response.json();
}

function App() {
const [userId, setUserId] = createSignal();
const [user] = createResource(userId, fetchUser);

return (
<div>
<input
type="number"
min="1"
placeholder="Enter Numeric Id"
onInput={(e) => setUserId(e.currentTarget.value)}
/>
<Show when={user.loading}>
<p>Loading...</p>
</Show>
<Switch>
<Match when={user.error}>
<span>Error: {user.error}</span>
</Match>
<Match when={user()}>
<div>{JSON.stringify(user())}</div>
</Match>
</Switch>

</div>
);
}
It will not show loading text at all, just the whole page refreshes when typing to input. This is quiet confusing when coming from normal SolidJS, that createResource loading etc are now useless. Thanks!
76 replies
SSolidJS
Created by Ciantic on 12/6/2022 in #support
How to use Hash Mode Router in SolidStart?
I think this is not possible at the moment, as properties for StartRouter isn't configurable, but I'd prefer hash mode routing for SPA.
14 replies