@oxyhq/core 3.8.2 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,9 +93,23 @@ export class OxyServicesBase {
93
93
  * OxyServices instance mounted in OxyProvider. The returned client has its own
94
94
  * base URL, cache and request queue, but its bearer token is kept in lockstep
95
95
  * with this session and its 401 refresh path delegates back to this session.
96
+ *
97
+ * **GET response caching is OFF by default for linked clients.** The SDK's
98
+ * per-instance GET cache is only safe where the SDK OWNS invalidation: on the
99
+ * canonical OxyServices client, every mutation (`updateProfile`, `followUser`,
100
+ * `blockUser`, …) busts the matching cached GET. A linked client targets the
101
+ * consuming app's OWN backend (`api.mention.earth`, `api.syra.fm`, …), whose
102
+ * resources and write endpoints the SDK has no knowledge of — so it cannot
103
+ * invalidate them, and a cached GET there would silently serve stale data
104
+ * after the app mutates its own data. Caching is therefore unsafe-by-construction
105
+ * here and is left to the consumer's own layer (React Query / stores), which
106
+ * owns its invalidation. Pass `createLinkedClient({ baseURL, enableCache: true })`
107
+ * to explicitly opt back in when the consumer accepts that responsibility.
96
108
  */
97
109
  createLinkedClient(config) {
98
- const client = new HttpService(config);
110
+ // Default the GET cache OFF unless the caller explicitly opts in (see the
111
+ // method doc): the SDK cannot invalidate the consumer backend's resources.
112
+ const client = new HttpService({ ...config, enableCache: config.enableCache ?? false });
99
113
  const syncToken = (accessToken) => {
100
114
  const currentAccessToken = client.getAccessToken();
101
115
  if (accessToken) {