dswistowski
dswistowski
SSolidJS
Created by dswistowski on 6/9/2024 in #support
can I configure seroval plugins?
I have a few internal objects which I do return from my server functions, when data is serialised with seroval i do get: The value [object Object] of type "object" cannot be parsed/serialized. error. I can add the ability to serialise/deserialise these objects by seroval by adding a plugin. Still, i do not have idea how i can change the default plugins solid start seroval is using - or if it's even possible
3 replies
SSolidJS
Created by dswistowski on 6/3/2024 in #support
Whole page component rerenders in default Solid-Start project
When I'm trying to use input field, the whole page rerender after loading data from resource, causing input to lost focus. How to reproduce: 1. Start new solid start project ( pnpm create solid && pnpm install) 2. create does-rerender route: ( file: src/routes/does-rerender.tsx): (it's from tutorial)
import { createSignal, createResource } from "solid-js";

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

const DoesRerender = () => {
const [userId, setUserId] = createSignal();
const [user] = createResource(userId, fetchUser);

return (
<>
<input
onInput={(e) => setUserId(e.currentTarget.value)}
/>
<div>
<pre>{JSON.stringify(user(), null, 2)}</pre>
</div>
</>
);
};
import { createSignal, createResource } from "solid-js";

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

const DoesRerender = () => {
const [userId, setUserId] = createSignal();
const [user] = createResource(userId, fetchUser);

return (
<>
<input
onInput={(e) => setUserId(e.currentTarget.value)}
/>
<div>
<pre>{JSON.stringify(user(), null, 2)}</pre>
</div>
</>
);
};
3. Start server: pnpm dev After typing 1 Luke Skywalker record is shown, but whole page rerenders and input does lost focus
5 replies