diff --git a/utils/cloud.js b/utils/cloud.js index d65896a..4d11ced 100644 --- a/utils/cloud.js +++ b/utils/cloud.js @@ -195,13 +195,12 @@ const _doPush = async () => { return } } - } else { - console.log('[cloud] _doPush no openid available, aborting (avoid duplicate add)') - return - } + } // else: openid is null — skip locate+update, go straight to add() - // Reached only when we've positively confirmed no doc exists for our - // openid in the cloud — safe to add() the first document. + // Reached when: (a) openid exists but no doc found, OR (b) openid is + // null (getOpenid not deployed). In both cases add() is safe — CloudBase + // auto-populates _openid on document creation. + console.log('[cloud] _doPush adding new doc (openid=' + (openid || 'null') + ')') const res = await db.collection(DB_COLLECTION).add({ data }) if (res && res._id) _docId = res._id if (res && res._openid) _openid = res._openid