| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-09-22 17:53:34 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-09-22 17:53:34 UTC |
| parent | 050f1302e280cd41d72dab6f7c084cc60f39ae85 |
| borogove/persistence/IDB.js | +10 | -1 |
diff --git a/borogove/persistence/IDB.js b/borogove/persistence/IDB.js index 5a53b83..bca9490 100644 --- a/borogove/persistence/IDB.js +++ b/borogove/persistence/IDB.js @@ -536,7 +536,16 @@ export default async (dbname, media, tokenize, stemmer) => { }), ); - await Promise.all(message.attachments.map((a) => a.lookup(obj))); + const attachmentPromise = Promise.all( + message.attachments.map((a) => a.lookup(obj)), + ); + if (!store) { + // If there is a store then we are mid-transaction + // So we can't safely await non-IDB work in that context + // But that could result in a race condition if the UI gets this + // hydrated message before the lookup is done + await attachmentPromise; + } return message; }