firebase / firebase/firebase-admin-node

Realtime Database - reading data gives wrong value if transaction is pending

オープン
#2,634 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
api: database
主要言語
TypeScript
スター
1.7k
フォーク
419
平均マージ
3日 10時間
マージ済み PR(30日)
16

説明

### [REQUIRED] Step 2: Describe your environment

* Operating System version: macOS 14.5 (23F79)
* Firebase SDK version: 12.2.0
* Firebase Product: database
* Node.js version: v20.13.0
* NPM version: v10.5.2

### [REQUIRED] Step 3: Describe the problem

If a transaction is pending for a node, it doesn't show up when reading data for the parent node with `.once("value", ...)`. I'm not sure if this is a bug or intended behavior.

#### Steps to reproduce:

For these examples, our database looks like this:

```json
{
"example_list": [
"a",
"b",
"c"
]
}
```

This code works as expected:

```js
let ref = admin.database().ref("example_list");

ref.once('value', (snap) => {
console.log(snap.val())
});
```

Logs: `[ 'a', 'b', 'c' ]`

This code does NOT work as expected:

```js
admin.database().ref("example_list/1").transaction((currentData) => {
return currentData;
});

let ref = admin.database().ref("example_list");

ref.once('value', (snap) => {
console.log(snap.val())
});
```

Logs: `[ 'a', <1 empty item>, 'c' ]`

Adding a transaction first, which seems like a no-op, actually causes the read to return a different result.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。