Catch not= throwing exceptions and log a warning #344
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Under certain conditions,
not=
in the defaultshouldComponentUpdate
function can throw an exception.You can boil this down to:
This is ultimately a bug in ClojureScript (and Clojure), but in the general case,
not=
doesn't guarantee that it won't throw, and there are weird edge cases like this that pop up now and then when comparing composite data types (especially when they are not standard vector/map/set/list's).You could imagine try/catching and swallowing the exception, which is technically correct as you can make a good assumption that if a comparison failed then the two objects aren't equal. But this feels pretty gross.
I propose that there is a try/catch which prints a warning/error explaining what happened, and that you can fix it by synthetically setting the key to be different for each piece of data you provide as an argument to the component.
Todo: