Julio Barros
Julio Barros
Explore posts from servers
SSolidJS
Created by Julio Barros on 11/22/2023 in #support
cascading createRouteData
Hi, I'm using SolidStart sometimes want to create a routeData function with two createRouteData calls where one depends on the other. For example I may have the todo.id but need to fetch the todo to get the todo.listId is there a good pattern to do this? I don't always control the backend so can't fetch both pieces of data in one call (ie. todoWithList or something). TIA.
1 replies
DTDrizzle Team
Created by Julio Barros on 11/3/2023 in #help
migrate with node-postgres
I had migration working well with postgresjs but need to switch to node-postgres for other reasons. But I can't get migration to work and it just hangs. The code I have is:
import { drizzle } from "drizzle-orm/node-postgres";
import { migrate } from "drizzle-orm/node-postgres/migrator";
import * as schema from "~/db/schema";

const migrationClient = new Client({ connectionString: dbURL });
await migrate(drizzle(migrationClient), {
migrationsFolder: "./migrations",
});
import { drizzle } from "drizzle-orm/node-postgres";
import { migrate } from "drizzle-orm/node-postgres/migrator";
import * as schema from "~/db/schema";

const migrationClient = new Client({ connectionString: dbURL });
await migrate(drizzle(migrationClient), {
migrationsFolder: "./migrations",
});
Also how/where do you set max with pg? TIA.
10 replies
SSolidJS
Created by Julio Barros on 11/2/2023 in #support
Running a script in a solid start project
Hi, I'd like to run a script, to seed my db, in a solid start project. I thought id just be able to npx ts-node src/foo.ts but I get an error TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" Any ideas on how to get this to work? TIA.
5 replies
SSolidJS
Created by Julio Barros on 10/2/2023 in #support
Using signal in child component
Hi, I'm new to all this and am trying to figure out how to control a signal from a child component. In my case I'm using solid-bootstrap to present a modal. The modal showing and hiding is triggered by a signal 'show' which is set by a button to show it and a cancel button to hide it. It all works great in one big component but I'd like to break the modal out to another component and have it be able to close itself. Since it opens with a button in the parent I think I need the signal there, but when I try to pass it to the child as a function <MyModal setShow={setShow} /> it does not work. What is a good way to structure something like this? Thanks in advance.
10 replies
DTDrizzle Team
Created by Julio Barros on 4/5/2023 in #help
jsonb field definition.
What's the right way to define a jsonb field? I have a type type MetaData = {keywords?: string[];} and a field meta: jsonb<MetaData>("meta"), but I'm getting the typescript warnings Type 'PgJsonbBuilderInitial<MetaData>' is not assignable to type 'AnyPgColumnBuilder'.ts(2322) on the lhs and Type 'MetaData' does not satisfy the constraint 'string'.ts(2344) on the rhs. Thanks in advance.
9 replies
DTDrizzle Team
Created by Julio Barros on 3/22/2023 in #help
Getting results in document form rather than record
Hi, new to drizzle but liking it so far. Is there away to get the results in more of a 'document' structure? For example, I'd like to get {id: 1, user: "joe", posts: [{id : 1, title: "my first post"},{id : 2, title: "my second post"}]} rather than in record form [{id: 1, user: "joe", post: {id : 1, title: "my first post"}}, ...}]. I'm doing something like select({id ... post: {id: posts.id, title, posts.title}}). Thanks.
3 replies
SSolidJS
Created by Julio Barros on 3/10/2023 in #support
Events (oninput on keyup) stopped working?
I just asked in the solid-start channel but this may be a bigger issue than that. I may have done something dumb but I'm using solid start and my event handlers have stopped working. They were fine a little while ago but now none of them seem to fire (the value never changes). I've even gone back to the tutorial to get a basic example (code below) and it does not work. Any ideas on what I could have goofed up? I don't see any errors or warnings in either the browser console or the server window.
import { createSignal } from "solid-js";export default function FormExample() { const [value, setValue] = createSignal(""); function handleInput(e: Event) { console.log("WTF"); const target = e.target as HTMLInputElement; setValue(target.value); } return ( <div> <div> The value is {value()}</div> <input type="text" oninput={handleInput} /> </div> );}
import { createSignal } from "solid-js";export default function FormExample() { const [value, setValue] = createSignal(""); function handleInput(e: Event) { console.log("WTF"); const target = e.target as HTMLInputElement; setValue(target.value); } return ( <div> <div> The value is {value()}</div> <input type="text" oninput={handleInput} /> </div> );}
24 replies