Retrieving Firebase value using `once` callback with transaction

I would like to use the once method to retrieve data from a Firebase ref, but am not receiving any data in the snapshot. Here is the simple data retrieval:

EDIT After further inspection, I found that a transaction was being scheduled shortly after the once value listener. (For simplicity I will place the transaction directly after the listener for this code example.)

dataRef.once('value', function (snapshot) {
  snapshot.val(); // returns `null`
});

dataRef.transaction(function (currentValue) {
  if (currentValue) {
    // make changes
  }
  return currentValue;
});

There is data at this firebase ref. To verify, I tried using on instead of once. In this case, the callback is invoked twice:

dataRef.on('value', function (snapshot) {
  snapshot.val(); // returns `null` first, then called again and returns correct value
});

What is causing this behavior? I would expect the snapshot to have the correct value the first time the callback is invoked. Otherwise, the once method has no useful purpose.

In the Firebase docs for transaction there is a third argument applyLocally.

By default, events are raised each time the transaction update function runs. So if it is run multiple times, you may see intermediate states. You can set this to false to suppress these intermediate states and instead wait until the transaction has completed before events are raised.

Because of this default value, the once value listener is firing after the transaction runs locally the first time, even though no data has been retrieved from the server (passing null as the transaction's currentValue). By passing false as the applyLocally parameter, this local event is suppressed, and the once callback will only be invoked after data has been retrieved from the server:

dataRef.transaction(function (currentValue) {
  if (currentValue) {
    // make changes
  }
  return currentValue;
},
function(){},
false);