Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: CellSuccessProps no longer has the data type on queryResult #11640

Open
1 task done
richard-stafflink opened this issue Sep 26, 2024 · 2 comments
Open
1 task done
Labels
bug/needs-info More information is needed for reproduction topic/cells

Comments

@richard-stafflink
Copy link
Contributor

richard-stafflink commented Sep 26, 2024

What's not working?

When using CellSuccessProps the TData type on these fields used to be typed, but now are always any:

  1. queryResult.fetchMore.data
  2. queryResult.previousData

The TData generic type that was passed in with CellSuccessProps<TData, ....> used to be passed down and inherited by QueryOperationResult

How do we reproduce the bug?

  1. Create a new RW app: yarn create redwood-app my-redwood-project --typescript
  2. Add the "Post" example model in schama.prisma
  3. yarn rw prisma migrate dev
  4. yarn redwood generate scaffold post
  5. Add the code below in the Success function of web/src/components/Post/PostCell/PostCell.tsx
  if ('variables' in queryResult) {
    const { data } = await queryResult.fetchMore({
      variables: { id: post.id },
    })

    // data is `any` but should be `FindPostById`
    const _data = data

    // previousData is `any` but should be `FindPostById`
    const _previousData = queryResult.previousData
  }

What's your environment? (If it applies)

N/A

Are you interested in working on this?

  • I'm interested in working on this
@richard-stafflink richard-stafflink added the bug/needs-info More information is needed for reproduction label Sep 26, 2024
@richard-stafflink
Copy link
Contributor Author

PR to fix this: #11639

@Josh-Walker-GM
Copy link
Collaborator

Josh-Walker-GM commented Sep 26, 2024

Thanks @richard-stafflink! Awesome you've opened a PR for this too! I'll see if either myself or someone else can take a look as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction topic/cells
Projects
Status: Backlog
Development

No branches or pull requests

2 participants