question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matching of reactive keys not working

See original GitHub issue

I will give an example to show my issue. I have a query key like this: reactive(['products', 'show', productId]), where productId is a Ref. If I use setQueryData with this key, the change is not reflected in a query that uses exactly the same key. I know the problem is the ref because if I use this key instead it works: reactive(['products', 'show', productId.value]).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DamianOsipiukcommented, Jan 17, 2022

@aantipov If we would create a wrapper for QueryClient we should create a wrapper for QueryCache and MutationCache. Not to mention react-query persistor plugins and all other hooks that we have.

Nevertheless i think it is a valid concern and we could create a single utility to deepUnref an object/array and use it everywhere.

0reactions
DamianOsipiukcommented, Jan 20, 2022

I think that this hash function is only relevant for hooks, and it can also be set in provider via queryClient.setDefaultOptions.

But it will not work on other functions that uses queryKey like queryClient.invalidateQueries or queryClient.getQueriesData. They are using partial matching and therefore require non-stringified version of the query key (Relevant piece of code).

Also besides unwrapping queryKey we would need to unwrap options objects as well to streamline the experience if we are going this way.

So either:

  • we create wrappers and deepUnref everything everywhere
  • we put in the documentation that when working with QueryClient QuerueryCache etc. user has to unwrap parameters by himself (maybe using our deepUnref utility). Only hooks deal with unwrapping automatically.

~Personally i would go with option 2. This would be much easier to maintain, as we would not have to track changes in the core and only care about properly working hooks. Unless there is very high demand for option 1.~

Edit: When i thought about it more creating wrappers seems like the way to go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Reactive extensions: matching complex key press sequence
Save this question. Show activity on this post. What I'm trying to achieve is to handle some complex key press and release sequence...
Read more >
How to Fix Windows 10 Product Key Activation Not Working
Are you having a problem getting Windows 10 to activate with your product key? Here's a look at some ways to fix the...
Read more >
Reactive Forms rules for name and formControlName ... - GitHub
When using Reactive Forms and radio buttons, an error is logged indicating that the name and formControlName attributes must match, even for ...
Read more >
How to Validate Angular Reactive Forms - freeCodeCamp
In this article, we will learn about validations in reactive forms in ... If the values do not match, we will set the...
Read more >
How to configure Logitech Lightsync RGB lighting ... - YouTube
In this video, JC walks you through the setup and special features of Logitech's Lightsync-enabled RGB gaming peripherals, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found