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

getQueryData function #3490

Closed
edrickleong opened this issue Jul 4, 2022 · 9 comments · Fixed by #3648
Closed

getQueryData function #3490

edrickleong opened this issue Jul 4, 2022 · 9 comments · Fixed by #3648

Comments

@edrickleong
Copy link
Contributor

What do you want and why?

I want an exported getQueryData function that takes in a resolver.

Instead of having to get the query key manually, such as below

const queryKey = getQueryKey(getTasks, { taskListId })
const tasks = queryClient.getQueryData<PromiseReturnType<typeof getTasks>>(queryKey)

I want to be able to write

const tasks = getQueryData(getTasks, { taskListId }))

Possible implementation(s)

Add a function getQueryData similar to the setQueryData function defined in react-query-utils as below.

export function setQueryData<TInput, TResult, T extends AsyncFunc>(

Additional context

The main use case I have for this is to do optimistic updates. See example from react query docs.

@blitzjs-bot blitzjs-bot added this to Triage in Dashboard Jul 4, 2022
@beerose beerose added the toolkit label Jul 5, 2022
@beerose beerose added the status/ready-to-work-on This issue is up for grabs label Jul 14, 2022
@Zeko369 Zeko369 added the good first issue Good for newcomers label Jul 16, 2022
@pivotrooky
Copy link

pivotrooky commented Jul 18, 2022

Hi!
I would like to work on this issue since it is marked as a good first issue.
Would that be ok?

@abuuzayr
Copy link
Collaborator

absolutely @pivotrooky ! give us a shout if you need any help

@blitzjs-bot blitzjs-bot added status/assigned and removed status/ready-to-work-on This issue is up for grabs labels Jul 18, 2022
@Himanxu1
Copy link

Hey , I want to work on this issue ..
Assign this to me .
@abuuzayr

@pivotrooky
Copy link

Oh, ok. @Himanxu1 I'd only just started, so fine by me :D @abuuzayr

Hey , I want to work on this issue .. Assign this to me . @abuuzayr

@Himanxu1
Copy link

OK @pivotrooky .I am also a beginner

@beerose
Copy link
Contributor

beerose commented Jul 27, 2022

Hey @Himanxu1, I think @pivotrooky meant that he was already assigned to this issue :) In general, it's helpful to look at the discussion and see if someone was already assigned or created a PR or mentioned that they are going to work on an issue. This way, we can avoid working on the same things and any future confusion. I hope you can decide between you two who's going to work on this one :)

@pivotrooky
Copy link

pivotrooky commented Jul 27, 2022

@beerose I'd like to free up this issue, as there'll be plenty of issues to work on in the future.
Could you please unassign me?
I'm not sure if the option to do it myself is available as I'm not yet a collaborator but, if it is, I can't find seem to find the button.
Thank you very much!

@beerose beerose assigned Himanxu1 and unassigned pivotrooky Jul 28, 2022
@edrickleong
Copy link
Contributor Author

I have talked to @Himanxu1 about picking up this ticket on discord and he's ok with passing this to me. Could this be assigned to me instead?

@edrickleong edrickleong mentioned this issue Aug 1, 2022
2 tasks
@beerose
Copy link
Contributor

beerose commented Aug 1, 2022

I have talked to @Himanxu1 about picking up this ticket on discord and he's ok with passing this to me. Could this be assigned to me instead?

Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

7 participants