add optional chaining operator to organization and guide information … #3762
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.
…to prevent string methods from trying to execute with a null value
What github.com/wevote/WebApp/issues does this fix?
This is fixing issue WV-158 "The Search bar on "All Endorses" for any Topic rejects user queries"
Changes included this pull request?
The only change was including the optional chaining operator to lines 214-216 and 223-225. The toLowerCase() string method was trying to operate on the details for 'organization' and 'guide' before that data was available. The optional chaining operator prevented it from running before there was a value present.
Additional Notes
I would also add that in my local environment, not "every" topic created this bug behavior. The only two I could find at a quick glance that did it for me were the "Pro Choice" topic and "2nd Amendment Gun Rights" topics. Many other topics did not display the error behavior for me/