Sheraff / soft-serve-tunes

Self hosted music server on raspberry pi
7 stars 0 forks source link

trpc 10.7.0 `getQueryKey` => SW & agnostic cache invalidation #34

Closed Sheraff closed 1 year ago

Sheraff commented 1 year ago

Every time we need agnostic access to the cache (mainly for cache invalidation on messages from service worker), we should use getQueryKey instead of assuming we know the shape of the key.

Right now, every version upgrade of tRPC needs to be thoroughly checked because a change in the underlying react-query cache keys and/or request param syntax might not be marked as "breaking" (since most users probably don't rely on them). Having a less leaky abstraction might make the whole thing more robust.

Sheraff commented 1 year ago

getQueryKey doesn't really apply (i think) because we're only "creating keys" from the service worker by intercepting already formed requests