Idea: Expose queryHash on QueryFunctionContext
#9811
Unanswered
ElliotChong-MS
asked this question in
Ideas
Replies: 1 comment
-
|
I created an associated PR for this proposal: #9812 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, query functions only receive
queryKey, which forces consumers to either recompute the hash or perform an expensivefindin theQueryCacheto determine the canonical identifier for a query instance. This adds unnecessary complexity and overhead for libraries and applications that need a stable, unique identifier for queries.The proposal is to expose
queryHashdirectly onQueryFunctionContext. This value is already computed internally and used by the cache, so making it available is an additive, backward-compatible change. It provides a canonical identifier without requiring consumers to import internal utilities or replicate hashing logic.This feature would simplify integrations, improve performance, and ensure correctness by giving developers a reliable, official identifier for queries. It’s a small change with significant ergonomic and efficiency benefits.
I'd be happy to create a PR to implement this change, please let me know if you'd be interested.
Beta Was this translation helpful? Give feedback.
All reactions