diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index b96accd28..d047c4d4b 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -964,9 +964,11 @@ define([ // Get data about a given channel: use with hidden hashes common.getPadDataFromChannel = function (obj, cb) { if (!obj || !obj.channel) { return void cb('EINVAL'); } + // Note: no timeout for this command, we may only have loaded the cached drive + // and need to wait for the fully synced drive postMessage("GET_PAD_DATA_FROM_CHANNEL", obj, function (data) { cb(void 0, data); - }); + }, {timeout: -1}); }; diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 7e1dad783..f4fa534bb 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1268,8 +1268,17 @@ define([ } }); }); + var result = res || viewRes; + + // If we're not fully synced yet and we don't have a result, wait for the ready event + if (!result && store.offline) { + onReadyEvt.reg(function () { + Store.getPadDataFromChannel(clientId, obj, cb); + }); + return; + } // Call back with the best value we can get - cb(res || viewRes || {}); + cb(result || {}); }; // Hidden hash: if a pad is deleted, we may have to switch back to full hash