Skip to content

Multiple events fired on a subscription when insert element on a list #2116

Closed
@Hanzofm

Description

@Hanzofm

Hi,

I have this structure RealTime structure

+Conversations
    -Conversation1
        -Messages
           -message1
           -message2

Initially I subscribe to the message changes with:

this.mylocalconversations.push({
     id,
     type,
     subscription: return 
      this.angularfire.object(Conversations/Conversation1/Messages);
       .snapshotChanges()
        .subscribe((conversation) => {
         console.log('new info')
       }),
   });

Then, i would insert new message with:

this.angularfire.list(Conversations/Conversation1/Messages).push(msg)

The result of this is:

new info
new info

Why the subcribe event fires twice?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions