Difficulty: Advanced
Category: Feature
Context: invalidateQuery today only supports exact-prefix matching over the ordered QueryKey tuple. There's no way to invalidate "all proposal queries for any project" without knowing the exact prefix, nor to invalidate by a predicate (e.g., "any query whose 2nd segment is this member address, regardless of position"). Several call sites likely reimplement ad-hoc multi-key invalidation loops as a workaround.
// dapp/src/service/cache/cacheStore.ts
export function invalidateQueryWhere(
predicate: (queryKey: import("./cacheTypes").QueryKey) => boolean,
): void {
// !todo: Add a predicate-based invalidation entry point alongside the existing
// prefix-based invalidateQuery, sharing the same underlying iteration/marking logic.
// !todo: Must compose with a trie-based index if one exists — avoid reintroducing a
// full-registry scan as the ONLY option for non-prefix invalidation patterns.
// !todo: Must emit the same isStale/isFetching/expiresAt transition as invalidateQuery
// for every matched entry, for hook-layer consistency.
throw new Error("Not implemented");
}
What contributors need to know:
- Problem:
cacheStore.ts only exports prefix-based invalidateQuery (cacheStore.ts:77-93).
- Related code:
cacheKeys.ts (existing QueryKey conventions), cacheHooks.ts.
- Suggested approach: grep call sites across
dapp/src/service for places that loop calling invalidateQuery multiple times to approximate a predicate match — that's the evidence this feature is actually needed.
- Acceptance criteria: at least one existing multi-call invalidation workaround in the codebase replaced with a single
invalidateQueryWhere call; new unit tests for predicate matching.
Difficulty: Advanced
Category: Feature
Context:
invalidateQuerytoday only supports exact-prefix matching over the orderedQueryKeytuple. There's no way to invalidate "all proposal queries for any project" without knowing the exact prefix, nor to invalidate by a predicate (e.g., "any query whose 2nd segment is this member address, regardless of position"). Several call sites likely reimplement ad-hoc multi-key invalidation loops as a workaround.What contributors need to know:
cacheStore.tsonly exports prefix-basedinvalidateQuery(cacheStore.ts:77-93).cacheKeys.ts(existingQueryKeyconventions),cacheHooks.ts.dapp/src/servicefor places that loop callinginvalidateQuerymultiple times to approximate a predicate match — that's the evidence this feature is actually needed.invalidateQueryWherecall; new unit tests for predicate matching.