Skip to content

Uncaught promise type error when unsubscribing from a liveQuery #648

@mullwaden

Description

@mullwaden

Getting an error when unsubscribing from a liveQuery. Uncaught (in promise) TypeError: _this2.resolve is not a function. The strange thing is that the original code does not contain the faulty resolve, however the distribution code does. I have no clue as to how this can be

** Original code **
https://github.com/parse-community/Parse-SDK-JS/blob/master/src/LiveQuerySubscription.js

  unsubscribe() {
    return CoreManager.getLiveQueryController().getDefaultLiveQueryClient().then((liveQueryClient) => {
      liveQueryClient.unsubscribe(this);
      this.emit('close');
    });
}

** Distribution code **
Found in npm_modules/parse/dist/parse.js

  (0, _createClass3.default)(Subscription, [{
    key: 'unsubscribe',
    value: function () {
      var _this2 = this;

      return _CoreManager2.default.getLiveQueryController().getDefaultLiveQueryClient().then(function (liveQueryClient) {
        liveQueryClient.unsubscribe(_this2);
        _this2.emit('close');
        _this2.resolve();  // <-- THIS IS THE FAULTY LINE OF CODE
      });
    }
  }]);

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