Loader is never shown if hover provider is called before providers are registered
Created by: lguychard
The hover tooltip has been designed to show a loader if no provider has emitted after 1200ms. However we have noticed some cases where this didn't work, for instance https://github.com/sourcegraph/sourcegraph/issues/9346#issuecomment-604581293:
While the message hasn't gotten a response yet, we don't show a loader. I don't know why, I'd assume this is a webapp bug we need to look into. We should show a loader in the hover after a very short time.
I managed to reproduce this locally. This will always happen when hovering over the token before extensions have activated:
- Since no providers are registered,
getLocationsFromProviders()
will emit an empty array - As a result,
getDefinitionUrl()
will emitnull
- As a result,
definitionUrlOrError
will emit beforeLOADER_DELAY
has lapsed, causing the loader to never show