Something went wrong on our end. Please try again.
Created by: vovakulikov
Prior to this PR in case a customer doesn't have any TODO search matches we failed our landing page in a bad (completely inaccessible) way - by rendering a full-page runtime error. This was happening because our FE response parsers weren't correct.
The following expression will throw an error in case if repositories array is empty (not undefined this is important but empty)
result.data.search?.results.repositories[0].name || ''
This PR simply fixes this problem by adding another nullish operator for the repositories
field
result.data.search?.results.repositories[0]?.name || ''
search?.results.repositories[0].name
should work
properly for this corner caseI gather my thoughs on how we could avoid problems like this in the future https://github.com/sourcegraph/sourcegraph/issues/31908