Vinny (@Wasp)
Vinny (@Wasp)
Explore posts from servers
WWasp-lang
Created by Vinny (@Wasp) on 4/2/2024 in #đŸ™‹questions
ui
Which ui component library works well with wasp
9 replies
WWasp-lang
Created by Vinny (@Wasp) on 4/13/2023 in #đŸ™‹questions
`wasp start db` issue --> docker: Cannot connect to the Docker daemon...
If you're getting the error docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. when trying to run wasp start db, make sure you have Docker installed and its running. On Mac OS, just find the Docker app in your launchpad and click it. You should see a Docker icon in your top right menu bar. If so, you're good to go!
6 replies
WWasp-lang
Created by Vinny (@Wasp) on 12/9/2022 in #đŸ™‹questions
Types on the Frontend
To get this question and answer forum going, I'm going to repost a really good question from @breadchris: so the first thing that got me caught up when going through the demo is that I was trying to have shared types between the frontend and backend code. I could setup the backend with the types from prisma:
import {Task} from '@prisma/client'

export const createTask = async (args: Task, context: any) => {
return context.entities.Task.create({
data: {description: args.description}
})
}
import {Task} from '@prisma/client'

export const createTask = async (args: Task, context: any) => {
return context.entities.Task.create({
data: {description: args.description}
})
}
but those are obviously not accessible from the frontend:
const Task = ({props: {task: Task}}) => {
return (
<div>
<input
type='checkbox' id={props.task.id}
checked={props.task.isDone}
/>
{props.task.description}
</div>
)
}
const Task = ({props: {task: Task}}) => {
return (
<div>
<input
type='checkbox' id={props.task.id}
checked={props.task.isDone}
/>
{props.task.description}
</div>
)
}
I would expect to be able to use Task here since I a common task will be to return down an object in its entirety to be formatted and viewed. The workaround here is to put the types in the shared folder, but it would be nice to keep these types in sync with the database. I am not sure how difficult it is to do, but it seems like the "hack" is to copy the index.d.ts from prisma's client into a place that is accessible to the frontend code? the index.d.ts file is all types so it should be fine, but is obviously a dirty hack lol. Would love to know your thoughts!
5 replies