Cache profile fields and assets behind one shared store.
Trigger cinny-mobile / dispatch (push) Successful in 1s

Colour, banner, collectibles, and profile each read the same extended
profile endpoint through separate caches with mismatched TTLs, so a
single profile view fired three round trips. They now read through one
cache with a shared TTL and in-flight dedupe, and profile media is kept
as blob URLs instead of being re-downloaded per mount.

useUserProfile now prefers the SDK's sync-cached user and only fetches
when both the SDK and the cache are cold.
This commit is contained in:
2026-10-06 07:42:47 +11:00
parent f2caef5592
commit 9b657e3ab4
8 changed files with 282 additions and 285 deletions
+1 -22
View File
@@ -239,28 +239,7 @@ export const initClient = async (session: Session): Promise<MatrixClient> => {
await mx.initRustCrypto({
storagePrefix: `${session.userId}@${session.deviceId}`,
});
// List databases after init to verify isolation
try {
const dbsAfterInit = await getAllIndexedDBNames();
console.log('[initMatrix] 📦 Databases after initialization:', dbsAfterInit);
// Check if a shared crypto database was created despite storagePrefix
const hasSharedCrypto = dbsAfterInit.includes('matrix-js-sdk::matrix-sdk-crypto');
if (hasSharedCrypto) {
console.warn('[initMatrix] ⚠️ WARNING: Shared crypto database still exists after init!');
console.warn('[initMatrix] The storagePrefix option may not be working correctly.');
}
// List account-specific databases
const accountDbs = dbsAfterInit.filter(db =>
db.includes(session.userId) || db.includes(session.deviceId)
);
console.log('[initMatrix] 📁 Account-specific databases:', accountDbs);
} catch (e) {
console.log('[initMatrix] Could not list databases after init:', e);
}
console.log('[initMatrix] ✅ Client initialized successfully!');
mx.setMaxListeners(50);