Skip to content

value events not firing properly when offline #1314

Closed
@k1r0s

Description

@k1r0s

From docs: https://firebase.google.com/docs/database/web/read-and-write#listen_for_value_events
related with offline capabilities: #17

image

[REQUIRED] Describe the problem

Value events should fire when ever a change occurs within the whole path. This is supposed to work offline as well, and it does! but not in the same way:

Steps to reproduce:

for example:

{ "todos": {
    "0001": { "text": "something", "uid": "0001" },
    "0002": { "text": "dumy", "uid": "0002" },
    "0003": { "text": "some text", "uid": "0003" }
  }
}

listening for event values on root ("todos"): ref('todos').on('value', f)

f should be called when:

  1. pushing a new reference to the collection: ref('todos').push({ "text": "a" })
  2. replacing the whole collection: ref('todos').set(..)

however offline. f only gets called when change occur directly on the explicit updated spot.

For example if I'm listening with: ref('todos').on('value', f) and I go offline case 2 works but case 1 does not.

Relevant Code:

  • online
ref('todos').on('value', f)
ref('todos').push({ foo: 2 })
ref('todos').set({ bar: 1 })

f should be called twice

  • offline
ref('todos').on('value', f)
ref('todos').push({ foo: 2 })
ref('todos').set({ bar: 1 })

f should be called twic, but gets called once (by set trigger)

[REQUIRED] Describe your environment

  • Operating System version: Linux k1r0s-N2x0WU 4.15.0-36-generic signInWithCustomToken - auth/invalid-api-key #39~16.04.1-Ubuntu SMP Tue Sep 25 08:59:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Browser version: Chromium Version 69.0.3497.81 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)
  • Firebase SDK version: "firebase": "^5.5.4"
  • Firebase Product: database

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions