feat: Warn user if XKit fails to initialize
Description
Proof of concept; I'm not sure what we would want to actually show here so I copied something from one of my dev scripts. (Clickable button with more info would be cool? Of course, this is not worth much effort, so...)
This makes a UI element appear if we're confident the user is logged in, but the XKit initialization function hasn't succeeded after [arbitrary value, I put 10] seconds. This was motivated by yet another wave of posts I saw about a) XKit mysteriously not working, and b) the site being slow. I'd love to be able to be slightly more confident about whether b is the cause of a.
I dunno. What do you think?
Resolves #1913, I guess.
Testing steps
Add an error to the init function in main.js, to one of the three critical utility functions that we preload, and/or to the injected functions they call using top level await. Observe that XKit modifications don't load and a warning message eventually appears.
Add a really long delay to the init function in main.js, to one of the three critical utility functions that we preload, and/or to the injected functions they call using top level await. Observe that a warning message appears, but then disappears as XKit modifications eventually load.
Repeat this when logged out and confirm that nothing happens.
I like the concept. I wouldn't have this extracted out to a util, though; we're not going to reuse it.
And if you're looking for a better arbitrary number than 10s, I think 60s gives us more confidence that something has gone awfully wrong.
I feel like as a user I would want to be informed before an entire minute has passed :D