wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
12.76k stars 1.14k forks source link

Automatic Crud Override Issue #2032

Closed atasoya closed 4 days ago

atasoya commented 1 month ago

Describe the bug When getAll query is overrode and custom logic requires arguments from client, wasp doesn't let to provide arguments.

To Reproduce Steps to reproduce the behavior:

  1. Create crud object in .wasp file.
  2. Override getAll query and use arguments.
  3. Call query from client with arguments.
  4. See error

Expected behavior Let argument passed from client.

infomiho commented 1 month ago

@atasoya thank you for the report, I've assigned myself to test this out and see what's going on.

infomiho commented 3 weeks ago

Yep, it seems that our implementation currently doesn't support passing arguments to the CRUD override function for getAll on the client.

The implementation should be improved to make sure the tasksCrud.useQuery is working in the same way as useQuery.

One temporary workaround (temporary because we will fix this) is to use the useQuery helper with the CRUD query directly like this:

import { tasks as tasksCrud } from 'wasp/client/crud'
import { useQuery } from 'wasp/client/operations'

const { data: tasks, isLoading } = useQuery(tasksCrud.getAll.query, {
  filter: 'my search',
})