{"action":"opened","issue":{"url":"https://api.github.com/repos/matthewp/haunted/issues/152","repository_url":"https://api.github.com/repos/matthewp/haunted","labels_url":"https://api.github.com/repos/matthewp/haunted/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/matthewp/haunted/issues/152/comments","events_url":"https://api.github.com/repos/matthewp/haunted/issues/152/events","html_url":"https://github.com/matthewp/haunted/issues/152","id":524131534,"node_id":"MDU6SXNzdWU1MjQxMzE1MzQ=","number":152,"title":"useMemo, gracefully fail when no dependencies are provided","user":{"login":"ChrisBrownie55","id":19195374,"node_id":"MDQ6VXNlcjE5MTk1Mzc0","avatar_url":"https://avatars2.githubusercontent.com/u/19195374?v=4","gravatar_id":"","url":"https://api.github.com/users/ChrisBrownie55","html_url":"https://github.com/ChrisBrownie55","followers_url":"https://api.github.com/users/ChrisBrownie55/followers","following_url":"https://api.github.com/users/ChrisBrownie55/following{/other_user}","gists_url":"https://api.github.com/users/ChrisBrownie55/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisBrownie55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisBrownie55/subscriptions","organizations_url":"https://api.github.com/users/ChrisBrownie55/orgs","repos_url":"https://api.github.com/users/ChrisBrownie55/repos","events_url":"https://api.github.com/users/ChrisBrownie55/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisBrownie55/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-11-18T04:44:54Z","updated_at":"2019-11-18T04:44:54Z","closed_at":null,"author_association":"NONE","body":"### `useMemo` should gracefully fail when missing its `dependencies`\r\n\r\nWhen incorrectly using `useMemo`/`useCallback` without dependencies, useMemo throws with a very cryptic error message:\r\n> TypeError: Cannot read property 'some' of undefined\r\n\r\nIt would be better to fail gracefully and warn the user of their fault. A good warning example might be one from eslint-plugin-react-hooks:\r\n> Hook useMemo does nothing when called with only one argument. Did you forget to pass an array of dependencies?\r\n\r\nI think the best way to fail gracefully would be to have the property `values` of the method `hasChanged` default to an empty array.\r\n```js\r\nhasChanged(values = []) {\r\n  return values.some((value, i) => this.values[i] !== value);\r\n}\r\n``` "}}
{"actor":{"display_login":"ChrisBrownie55"}}