mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 03:32:40 +08:00
FIX: lockup when navigating with j/k (#30674)
If, for some reasons, navigating between posts using j/k keyboard shortcuts does not select any posts, there could be an infinite loop due to setting the `direction` to `0` and then using it do "iterate" over the arrays of available "articles". Despite many attemps, I wasn't able to reproduce the issue reported in https://dev.discourse.org/t/145565 so this is somewhat of a shot in the dark.
This commit is contained in:
parent
c39893364b
commit
773857848b
|
@ -775,6 +775,11 @@ export default {
|
|||
if (article.getBoundingClientRect().height > 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Safeguard against infinite loops
|
||||
if (direction === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (const a of articles) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user