{"action":"created","issue":{"url":"https://api.github.com/repos/steelsojka/lodash-decorators/issues/10","labels_url":"https://api.github.com/repos/steelsojka/lodash-decorators/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/steelsojka/lodash-decorators/issues/10/comments","events_url":"https://api.github.com/repos/steelsojka/lodash-decorators/issues/10/events","html_url":"https://github.com/steelsojka/lodash-decorators/issues/10","id":98050383,"number":10,"title":"Debounce#cancel undefined","user":{"login":"mmw","id":9445182,"avatar_url":"https://avatars.githubusercontent.com/u/9445182?v=3","gravatar_id":"","url":"https://api.github.com/users/mmw","html_url":"https://github.com/mmw","followers_url":"https://api.github.com/users/mmw/followers","following_url":"https://api.github.com/users/mmw/following{/other_user}","gists_url":"https://api.github.com/users/mmw/gists{/gist_id}","starred_url":"https://api.github.com/users/mmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmw/subscriptions","organizations_url":"https://api.github.com/users/mmw/orgs","repos_url":"https://api.github.com/users/mmw/repos","events_url":"https://api.github.com/users/mmw/events{/privacy}","received_events_url":"https://api.github.com/users/mmw/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-29T23:28:20Z","updated_at":"2015-08-21T15:13:21Z","closed_at":"2015-07-31T12:58:59Z","body":"For some reason it looks like we lost the `cancel` function from `debounce`.\r\n\r\nExample:\r\n```\r\nclass Search extends React.Component {\r\n  static propTypes = {\r\n    setSearchQuery: React.PropTypes.func\r\n  };\r\n\r\n  state = { searchQuery: null };\r\n\r\n  @debounce(200)\r\n  debouncedSearch(searchQuery) {\r\n    this.props.setSearchQuery(searchQuery);\r\n  }\r\n\r\n  handleSearch = (evt) => {\r\n    const searchQuery = evt.target.value.trim();\r\n\r\n    if(searchQuery === '') {\r\n      this.clearSearchQuery();\r\n    } else {\r\n      this.debouncedSearch(searchQuery);\r\n      this.setState({ searchQuery });\r\n    }\r\n  }\r\n\r\n  clearSearchQuery = () => {\r\n    const searchQuery = null;\r\n\r\n    this.debouncedSearch.cancel(); // undefined\r\n    this.props.setSearchQuery(searchQuery);\r\n    this.setState({ searchQuery });\r\n  }\r\n\r\n  render() {\r\n    return (\r\n      <input\r\n        type=\"text\"\r\n        onChange={this.handleSearch}\r\n        value={this.state.searchQuery}\r\n      />\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nIs anyone able to reproduce this or is it just me?"},"comment":{"url":"https://api.github.com/repos/steelsojka/lodash-decorators/issues/comments/133458560","html_url":"https://github.com/steelsojka/lodash-decorators/issues/10#issuecomment-133458560","issue_url":"https://api.github.com/repos/steelsojka/lodash-decorators/issues/10","id":133458560,"user":{"login":"mmw","id":9445182,"avatar_url":"https://avatars.githubusercontent.com/u/9445182?v=3","gravatar_id":"","url":"https://api.github.com/users/mmw","html_url":"https://github.com/mmw","followers_url":"https://api.github.com/users/mmw/followers","following_url":"https://api.github.com/users/mmw/following{/other_user}","gists_url":"https://api.github.com/users/mmw/gists{/gist_id}","starred_url":"https://api.github.com/users/mmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmw/subscriptions","organizations_url":"https://api.github.com/users/mmw/orgs","repos_url":"https://api.github.com/users/mmw/repos","events_url":"https://api.github.com/users/mmw/events{/privacy}","received_events_url":"https://api.github.com/users/mmw/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T15:13:21Z","updated_at":"2015-08-21T15:13:21Z","body":"Yep, the snippet you pasted is exactly right. I'm using it with webpack and react so I'm exporting the class and extending `React.Component` as well.\r\n\r\nAlso seems related: the debounced function is no longer on the prototype. Previously I was successfully stubbing the function in my tests, which also no longer works with the V1 update.\r\n\r\n```\r\ndescribe('Person test', () => {\r\n  let dbStub;\r\n\r\n  beforeEach(() => {\r\n    dbStub = sinon.stub(Person.prototype, 'debouncedFn');\r\n  });\r\n\r\n  // test cases...\r\n});\r\n```\r\n\r\nResults in: `TypeError: Attempted to wrap undefined property debouncedSearch as function`"}}