,我有以下數據開始:火力地堡查詢不將數據推然後重新添加
"holidays": {
...
"2016-12-19": {
"stegosaurus": true
},
"2016-12-20": {
"lambeosaurus": true,
"stegosaurus": true
},
"2016-12-21": {
"lambeosaurus": true
},
...
}
用下面的查詢,
ref.orderByKey().startAt("2016-12-18")
.endAt("2016-12-18")
.on("child_added", function(snapshot) {
console.log("child_added")
});
ref.orderByKey().startAt("2016-12-18")
.endAt("2016-12-18")
.on("child_removed", function(snapshot) {
console.log("child_removed")
});
ref.orderByKey().startAt("2016-12-18")
.endAt("2016-12-18")
.on("child_changed", function(snapshot) {
console.log("child_changed")
});
ref.orderByKey().startAt("2016-12-18")
.endAt("2016-12-18")
.on("child_moved", function(snapshot) {
console.log("child_moved")
});
在初始添加新節點「 2016-12-18「到」節假日「節點,我收到了一個child_added
事件。當節點「2016-12-18」被刪除時,我得到一個child_removed
事件。但是當我加回「2016-12-18」時,這次我沒有收到任何事件。這是一個firebase錯誤?
下面是複製這個問題jsbin: https://jsbin.com/sefaha/6/edit?html,console,output
重現:
1) On reload, Click Update button
2) Dino info is displayed
3) Click Delete button
4) Dino info is removed
5) Click Update button
6) Dino info is not displayed anymore
7) Reload/refresh browser
8) Dino info is displayed
9) Click Delete button
10) Repeat step (1)
請注意,在步驟(1),不顯示有時迪諾信息。這似乎取決於連接的客戶端的數量。
您分享的代碼實際上並沒有添加數據,因此很難確定。但總的來說,Firebase SDK的這一部分現在已經相當穩定了。總是有可能存在錯誤,在這種情況下,我很想看到[MCVE](http://stackoverflow.com/help/mcve)。如果你可以設置一個可以重現問題的jsbin,它通常會很有幫助嗎? –
@FrankvanPuffelen我用jsbin更新了這個問題來複制問題。感謝您查看這個。 – user3240644
感謝tje jsbin。它使用PolymerFire,而您的原始問題基於純粹的Firebase JavaScript SDK。鑑於我對PolymerFire的內部工作不熟悉(我真的應該更多地瞭解它,但今天不是那一天),您是否可以通過JavaScript SDK重現問題? –