在我反应过来,本地项目添加orderByChild火力过滤器时,即使该应用程序是阅读和筛选数据精我得到一个神秘的黄箱错误。
如果删除orderByChild一切工作正常。
代码给予警告:
export const peopleFetchAll = ({ name }) => {
console.log(`${name}`);
return (dispatch) => {
firebase.database().ref(`/people`).orderByChild("name").equalTo("Paul")
.once('value', snapshot => {
dispatch({ type:PEOPLE_FETCH_SUCCESS, payload:snapshot.val() });
});
};
};
良好的代码:
export const peopleFetchAll = ({ name }) => {
console.log(`${name}`);
return (dispatch) => {
firebase.database().ref(`/people`)
.once('value', snapshot => {
dispatch({ type:PEOPLE_FETCH_SUCCESS, payload:snapshot.val() });
});
};
};
我在世博园看到的错误是:
▼[2019-02-02T21:25:30.973Z] @firebase/database:
- node_modules\react-native\Libraries\ReactNative\YellowBox.js:80:15 in warn
- node_modules\expo\src\Expo.js:25:41 in warn
- node_modules\@firebase\logger\dist\index.cjs.js:66:31 in defaultLogHandler
- node_modules\@firebase\logger\dist\index.cjs.js:152:31 in warn
- node_modules\@firebase\database\dist\index.cjs.js:345:19 in warn
- node_modules\@firebase\database\dist\index.cjs.js:11818:21 in warnOnListenWarnings_
- node_modules\@firebase\database\dist\index.cjs.js:11788:55 in <unknown>
- node_modules\@firebase\database\dist\index.cjs.js:12052:27 in onDataMessage_
- node_modules\@firebase\database\dist\index.cjs.js:11337:24 in onDataMessage_
- node_modules\@firebase\database\dist\index.cjs.js:11331:32 in onPrimaryMessageReceived_
- node_modules\@firebase\database\dist\index.cjs.js:11232:52 in <unknown>
- node_modules\@firebase\database\dist\index.cjs.js:10837:27 in appendFrame_
- node_modules\@firebase\database\dist\index.cjs.js:10887:34 in handleIncomingFrame
- node_modules\@firebase\database\dist\index.cjs.js:10784:38 in onmessage
- node_modules\event-target-shim\lib\event-target.js:172:43 in dispatchEvent
- node_modules\react-native\Libraries\WebSocket\WebSocket.js:239:27 in <unknown>
- node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:180:12 in emit
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:351:47 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:116:26 in <unknown>
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314:6 in __guardSafe
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:115:17 in callFunctionReturnFlushedQueue
再次,一切工作正常,即使我得到警告。我只需要摆脱的警告,我似乎无法破译此。
你定义的下name
/people
指数,如下所示:firebase.google.com/docs/database/security/indexing-data?
如果不是,这可能是为警告的原因,但我不明白为什么它不会显示实际的警告信息。