ile
ile
SSolidJS
Created by ile on 6/19/2024 in #support
Beginner question about signals
I have this code:
const signal = createSignal('');

function ShowData(props: any) {
const data = props.data;

return data[0]() && <p>...{data[0]()}</p>;
}

export default function Home() {
return (
<main class="text-center mx-auto text-gray-700 p-4">
<ShowData data={signal} />
<button onclick={() => signal[1](Date.now() + '...')}>Set</button>
</main>
);
}
const signal = createSignal('');

function ShowData(props: any) {
const data = props.data;

return data[0]() && <p>...{data[0]()}</p>;
}

export default function Home() {
return (
<main class="text-center mx-auto text-gray-700 p-4">
<ShowData data={signal} />
<button onclick={() => signal[1](Date.now() + '...')}>Set</button>
</main>
);
}
How could I make the data in ShowData reactive, i.e. when I click the button, I would see the data?
4 replies
SSolidJS
Created by ile on 6/5/2024 in #support
Session stores in SolidStart
How to use different session stores in SolidStart? What is the default store? https://docs.solidjs.com/solid-start/advanced/session
2 replies
SSolidJS
Created by ile on 6/2/2024 in #support
Getting Prisma TypeError in the browser console in a SolidStart app after doing build and start:
The error: TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../". I will work on reproducing this. Development build works.
4 replies
SSolidJS
Created by ile on 6/1/2024 in #support
Getting random behavior from cache(), createAsync() and signals
16 replies
SSolidJS
Created by ile on 5/28/2024 in #support
Using SolidStart's prisma template app, getting odd error & crash from the route.
Crash log:
/home/ile/src/polvirekisteri/polvet/node_modules/@solidjs/start/dist/server/StartServer.jsx:65
__vite_ssr_import_6__.useAssets(() => assets.length ? assets.map((m) => __vite_ssr_import_8__.renderAsset(m)) : void 0);
^

TypeError: Cannot read properties of undefined (reading 'length')
at eval (/home/ile/src/polvirekisteri/polvet/node_modules/@solidjs/start/dist/server/StartServer.jsx:65:48)
at Array.<anonymous> (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:539:57)
at injectAssets (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:584:70)
at doShell (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:295:12)
at Object.onDone (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:163:5)
at Te.flush (file:///home/ile/src/polvirekisteri/polvet/node_modules/seroval/dist/esm/production/index.mjs:17:38999)
at file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:182:42
/home/ile/src/polvirekisteri/polvet/node_modules/@solidjs/start/dist/server/StartServer.jsx:65
__vite_ssr_import_6__.useAssets(() => assets.length ? assets.map((m) => __vite_ssr_import_8__.renderAsset(m)) : void 0);
^

TypeError: Cannot read properties of undefined (reading 'length')
at eval (/home/ile/src/polvirekisteri/polvet/node_modules/@solidjs/start/dist/server/StartServer.jsx:65:48)
at Array.<anonymous> (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:539:57)
at injectAssets (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:584:70)
at doShell (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:295:12)
at Object.onDone (file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:163:5)
at Te.flush (file:///home/ile/src/polvirekisteri/polvet/node_modules/seroval/dist/esm/production/index.mjs:17:38999)
at file:///home/ile/src/polvirekisteri/polvet/node_modules/solid-js/web/dist/server.js:182:42
The crash happens 50% of the time on hard refresh on this route. Sometimes it works, sometimes it crashes. Here's the route file:
import { createAsync, type RouteDefinition } from "@solidjs/router";
import { getUser } from "~/lib/patient/login";
import Header from "~/lib/ui/Header";

export const route = {
load: () => getUser()
} satisfies RouteDefinition;

export default function Home() {
const user = createAsync(() => getUser(), { deferStream: true });
console.log('....', user());

return (
<>
<Header user={user} />
<div class="pt-32 container mx-auto">
<h2 class="font-bold text-3xl">Hello {user()?.username}</h2>
</div>
</>
);
}
import { createAsync, type RouteDefinition } from "@solidjs/router";
import { getUser } from "~/lib/patient/login";
import Header from "~/lib/ui/Header";

export const route = {
load: () => getUser()
} satisfies RouteDefinition;

export default function Home() {
const user = createAsync(() => getUser(), { deferStream: true });
console.log('....', user());

return (
<>
<Header user={user} />
<div class="pt-32 container mx-auto">
<h2 class="font-bold text-3xl">Hello {user()?.username}</h2>
</div>
</>
);
}
Also, I get this console output (server side):
.... undefined
.... {
id: 'ae0f728b-2158-41e0-b170-fd3b863248e5',
username: 'ilkkah@....'
}
.... undefined
.... {
id: 'ae0f728b-2158-41e0-b170-fd3b863248e5',
username: 'ilkkah@....'
}
9 replies