Skip to content

Resubscribing to a watch() Observable causes duplicated data #738

@tomdegoede

Description

@tomdegoede

Server version: 1.1.3
Client version: 1.1.3

Unsubscribing and then resubscribing the same watch() Observable will cause records to be added to the collection even when they are already present.

var t = horizon('tasks');
t.store({title: 'test'}).subscribe(function (stored) {
    var id = stored.id;

    var watch = t.findAll(id).watch();

    var sub = watch.subscribe(function (r) {
        console.log(r);
    });

    setTimeout(function () {
        sub.unsubscribe();

        sub = watch.subscribe(function (r) {
            console.log(r);
        });
    }, 1000);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions