JetBrains: Handle “not logged in” state gracefully
Created by: vdavid
Fixes https://github.com/sourcegraph/sourcegraph/issues/37685 Fixes https://github.com/sourcegraph/sourcegraph/issues/36157
It needed some care to make sure that we're sending data, doing new searches, and updating the preview in all cases.
Also:
- Fixed a bug: auth actually depended on the config, but the config was loaded in parallel with the auth. :o This was only not apparent because of the duplication of auth calls.
- Fixed another bug: after a user switch, the initial search didn't fire. (But this solution might still be buggy, see the test plan below)
- Made the PreviewPanel state setting interface simpler / more foolproof and also more extensible.
- Added a few missing null checks and fixed a warning.
Test plan
- Demoed that it works in this 2-min Loom
- There is a slight glitch at the end which I think is small enough that this is good as it is, but I'll also try to debug and fix that before I merge this. The glitch itself is not created by the PR btw, the behavior would be the same on
main
.
- There is a slight glitch at the end which I think is small enough that this is good as it is, but I'll also try to debug and fix that before I merge this. The glitch itself is not created by the PR btw, the behavior would be the same on
- I think it's best to check the code commit by commit. I tried to be descriptive in my commit messages. Sorry for the lot of changes, this was actually trickier to implement than I'd thought.
App preview:
Check out the client app preview documentation to learn more.