简体   繁体   English

Firestore设置在第一次尝试时失败,但在第二次尝试时有效

[英]Firestore set fails on first try but works on second

I have a simple firestore set operation like so 我有一个像这样的简单的firestore设置操作

var docRef = firebase.firestore().collection('sessions').doc(this.state.userID);
docRef.set({
   Name: seshName,
   Type: theType,
}).then(()=> {
   resolve(true);
});

but for some reason, it always fails on the first try after app install, but then subsequent attempts are fast and smooth. 但由于某种原因,在安装应用后首次尝试总是会失败,但是随后的尝试又快速又流畅。

Anyone encounter similar experiences? 有人遇到过类似的经历吗? Any clues? 有什么线索吗?

Thanks for trying to help. 感谢您的帮助。 I found the cause. 我找到了原因。 Adding .catch does not help as it just hangs as usual without any output. 添加.catch并没有帮助,因为它像往常一样挂起而没有任何输出。

It seems that Firestore only allows 1 connection at a time? 看来Firestore一次只允许1个连接? This issue only happens if I do a DB action right before this .set operation, it seems that the previous DB action isn't complete yet. 仅当我在此.set操作之前立即执行数据库操作时,才会出现此问题,似乎先前的数据库操作尚未完成。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React setState 在第一次尝试时不起作用,但在第二次尝试时有效? - React setState not working on first try, but works on second? Highcharts oncahnge 事件它在第一次尝试时有效,但在第二次尝试时无效 - Highcharts oncahnge event It works on the first try but not on the second try Firestore 事务:将第一个文档的 id 设置为第二个文档 - Firestore transaction: set id of the first document to the second document 第一次尝试时,链接点击事件未触发按钮点击事件(仅限IE)。 第二次单击即可工作。 - link click event not firing button click event on the first try (IE only). Works on second click. POST函数运行两次,第一次API调用失败,第二次运行。 - POST function runs twice, first time API call fails, second time it works. 构造函数第二次失败,但不是第一次失败 - Constructor fails on second time, but not first 工具提示适用于第二个悬停而不是第一个悬停 - Tooltip works on Second hover not in First 快速路线仅在第二次尝试后有效 - Express route only works after the second try 在ExtJS 6中,第二个文件上传失败,在ExtJS 4中可用 - Second File Upload fails in ExtJS 6, works in ExtJS 4 iframe设置为click event。 它适用于打开页面后的首次点击。 但不适用于第二次。 请帮忙 - Iframe is set to click event . it works for First click after opening page. But not works for Second time. Please help On this
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM