在反应应用程序中,我在同一个文件中有两个几乎相同的函数来将文档添加到子集合中。一个每次都有效,另一个使用不同的子集合,大多数时候都会收到以下警告(注意:不是错误),并且不会添加数据。
\nawait addDoc(collection(db, 'users', uid, 'medications'), med);\nRun Code Online (Sandbox Code Playgroud)\n\n\n\xe2\x80\x8b[2022-02-16T20:54:44.216Z] @firebase/firestore: Firestore (9.6.6): 连接 WebChannel 传输错误: Vd\xc2\xa0{type: 'c', target: Y ,g:Y,defaultPrevented:false,状态:1}
\n
另一个奇怪的行为是,调用 addDoc 后,应用程序会重新导航到当前页面,但会将要添加到文档中的数据附加到 URL 中。页面中根本没有导航链接。无论是否添加数据都会发生这种情况。
\n\n\n导航到 http://localhost:3000/create?name=test+med+again&description=a+med+for+testing&form=capsule&dosage=1&measurement=ea&occurrence=2&often=daily
\n