Skip to content

Commit 1fae7b6

Browse files
committed
Fix auto-load-more-news
The button appears a bit later, so it can't stop listening to changes as soon as it can't find it
1 parent e7a2689 commit 1fae7b6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

source/features/auto-load-more-news.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import debounce from 'debounce-fn';
33
import observeEl from '../libs/simplified-element-observer';
44

55
let btn;
6-
let newsfeedObserver;
76

87
const loadMore = debounce(() => {
98
btn.click();
9+
btn.textContent = 'loading...';
1010

1111
// If GH hasn't loaded the JS, the click will not load anything.
1212
// We can detect if it worked by looking at the button's state,
@@ -37,8 +37,6 @@ const findButton = () => {
3737
btn = select('.ajax-pagination-btn');
3838
if (btn) {
3939
inView.observe(btn);
40-
} else if (newsfeedObserver) {
41-
newsfeedObserver.disconnect();
4240
}
4341
};
4442

@@ -48,6 +46,6 @@ export default () => {
4846
// If GH hasn't loaded the JS,
4947
// the fake click will submit the form without ajax.
5048
form.addEventListener('submit', event => event.preventDefault());
51-
newsfeedObserver = observeEl('#dashboard .news', findButton);
49+
observeEl('#dashboard .news', findButton);
5250
}
5351
};

0 commit comments

Comments
 (0)