readthedocs / ext-theme

Read the Docs drop in replacement site templates
2 stars 2 forks source link

Documentation link sometimes does nothing #444

Open humitos opened 1 month ago

humitos commented 1 month ago

I found myself clicking on the 📚 icon to access the documentation of that particular version/project but it just does nothing. Then, the second time I click on it, it works just fine.

I think the issue is that we are performing a request behind the scenes when the mouse hovers the icon and sometimes the response is not immediate [^1]. I thought a good idea here would be to perform the fetch when the user hovers any section of the row itself, not only the books icon.

[^1]: Are we caching these requests? I feel they should be immediate most of the times.

agjohnson commented 1 month ago

I have hit this and it is a problem of timing -- the request kicks off when you hover the list of buttons but doesn't finish before you click.

Good point on caching, these API responses are not cached at all. What is the history there, do we not want any sort of caching on the API responses normally? Caching will help some use cases, but probably not consistently enough to help this -- it's still a good change to make though.

I wouldn't do the fetch on row hover though. If we made it update when hovering over the row, moving the mouse down the table to click something other than these buttons (which should be common) would trigger a flood of unused requests. This could be not great and might have the opposite effect, where the client is waiting through these flood requests to receive response on an actual button hover/click.

Two options here are:

Both are better than silently failing, I think the click handler is mostly seamless though.

What I mean here is:

humitos commented 1 month ago

Add a click handler that saves the click event and waits for the data to load to make the redirect

I think this is a better pattern 👍🏼 -- it follows what's expected as a user: click on a link and get redirected.

ericholscher commented 2 days ago

Might be this: https://read-the-docs.sentry.io/issues/5906077802/?project=4507963896365056&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=24h&stream_index=0

agjohnson commented 2 days ago

It's just a timing issue, not a bug. The data is still loading and there is no href on the link when you click it too fast.

ericholscher commented 1 day ago

At least for me, it never loaded and did trigger a JS error.

agjohnson commented 1 day ago

That error is just on the profile page, it's missing some view configuration that the buttons require. On the other dashboard pages, this button works without errors but it is prone to timing problems