matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
438 stars 68 forks source link

[client] TypeError: Cannot convert undefined or null to object #552

Closed WayneUong closed 7 years ago

WayneUong commented 7 years ago
Error: Exception in template helper:
TypeError: Cannot convert undefined or null to object
    at Index._getSearchOptions (http://localhost:3000/packages/easysearch_core.js?hash=67fae06b36ef87160103b2efaadb9ff660272496:136:16)

options is undefined here:

  _getSearchOptions(options) {
    if (!Meteor.isServer) {
      delete options.userId;
    }

    if (typeof options.userId === "undefined" && Meteor.userId) {
      options.userId = Meteor.userId();
    }
    return _.defaults(options, this.defaultSearchOptions);
  }
WayneUong commented 7 years ago

it happens when I do not specify {{> EasySearch.Input}}

matteodem commented 7 years ago

Please provide a reproduction repo or steps.

kizim commented 7 years ago

@matteodem I got the same exception right after updated my project from Meteor 1.3.5.1 to 1.4.3.1.

matteodem commented 7 years ago

Can you provide a stack trace and reproduction repo or steps?

kolyasya commented 7 years ago

@matteodem have the same error here:

Index.prototype._getSearchOptions = function () {                                                               //
    function _getSearchOptions(options) {                                                                         //
      if (!Meteor.isServer) {                                                                                     // 88
        delete options.userId;                                                                                    // 89
      }                                                                                                           // 90
                                                                                                                  //
      if (typeof options.userId === "undefined" && Meteor.userId) {                                               // 92
        options.userId = Meteor.userId();                                                                         // 93
      }                                                                                                           // 94
                                                                                                                  //
      return _.defaults(options, this.defaultSearchOptions);                                                      // 96
    }                                                                                                             // 97
                                                                                                                  //
    return _getSearchOptions;                                                                                     //
  }();            

I guess it is because of options variable, it seems to be undefined here.