Set showing_news_id during updown hotkey, before waiting 100ms.
I was having issues where after using the up/down keys, sometimes the newsreader panel would show the wrong item, the second-to-last selected news. Since we wait 100ms before letting the up/down key populate the newsreader, there's a bit of limbo time which I think was the problem. This seems to have helped with that.
This commit is contained in:
parent
8b79773c5b
commit
a089775b54
1 changed files with 6 additions and 2 deletions
|
@ -1653,7 +1653,7 @@ function _up_down(sibling_func)
|
||||||
first_selected_news = neighbor;
|
first_selected_news = neighbor;
|
||||||
|
|
||||||
mark_read_with_batching(neighbor.dataset.id);
|
mark_read_with_batching(neighbor.dataset.id);
|
||||||
// console.log(`updown ${neighbor.dataset.id}`);
|
showing_news_id = neighbor.dataset.id;
|
||||||
clearTimeout(show_news_after_timeout);
|
clearTimeout(show_news_after_timeout);
|
||||||
show_news_after_timeout = setTimeout(() => {show_news_in_newsreader(neighbor);}, 100);
|
show_news_after_timeout = setTimeout(() => {show_news_in_newsreader(neighbor);}, 100);
|
||||||
mark_read_and_propagate_unread_delta(neighbor);
|
mark_read_and_propagate_unread_delta(neighbor);
|
||||||
|
@ -1779,6 +1779,10 @@ function set_newsreader_news_text(html)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When switching news items quickly, a previously requested news item might
|
||||||
|
// load after the user has already clicked on another one. So we store the most
|
||||||
|
// recently clicked id and don't show a previously clicked news whose callback
|
||||||
|
// has just come in.
|
||||||
let showing_news_id = null;
|
let showing_news_id = null;
|
||||||
function show_news_in_newsreader(news)
|
function show_news_in_newsreader(news)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue