title: Firebase 'value' event handler is called first with null value and then with the actual value
body: <p>I am using <code>firebase-queue</code> in a mobile app to offload some work to a server. I send tasks to the firebase queue with a request and start to listen to 'value' events at <code>responses/&lt;request-id&gt;</code> to get the response for the task. The firebase queue worker will receive the task, process it and set the results at <code>responses/&lt;request-id&gt;</code>.</p>
  
  <p>I am observing that the <code>value</code> event handler is called twice, initially with a null value and then will the actual response. I have this sample code which can be used to simulate the behavior</p>
  
  <p><strong>client.js</strong></p>
  
  <pre><code>var Firebase = require('firebase');
  
  var ref = new Firebase('https://propertyfindercp.firebaseio.com');
  
  ref.child('responses/&lt;request-id&gt;').on('value', function(snapshot) {
    console.log('Value event ', snapshot.val());
  });
  </code></pre>
  
  <p><strong>worker.js</strong></p>
  
  <pre><code>var Firebase = require('firebase');
  
  var ref = new Firebase('https://propertyfindercp.firebaseio.com');
  ref.child('responses/&lt;request-id&gt;').set({data: 123});
  </code></pre>
  
  <p>Just replace the <code>&lt;request-id&gt;</code> in both the files to some same random value and run the <code>client.js</code> file by using <code>node client.js</code> and then the <code>worker.js</code> by using <code>node worker.js</code></p>
  
  <p>I observe the following output on the client console</p>
  
  <pre><code>Value event  null
  Value event  { data: 123 }
  </code></pre>
  
  <p>I was expecting to see only the second line. Why is the <code>value</code> event handler called with a <code>null</code> value also?</p>