recent_topics: Call revive_current_focus as part of redraw process.

This makes more sense as it ensures we revive focus after every
redraw.
This commit is contained in:
Aman Agrawal
2020-09-23 13:07:29 +05:30
committed by Tim Abbott
parent a45d3af3e3
commit d2c2371c84
3 changed files with 10 additions and 2 deletions

View File

@@ -237,13 +237,18 @@ run_test("no filtering", () => {
const scroll_container = make_scroll_container();
container.html = () => {};
let callback_called = false;
// Opts does not require a filter key.
const opts = {
modifier: (item) => div(item),
simplebar_container: scroll_container,
callback_after_render: () => {
callback_called = true;
},
};
const widget = ListWidget.create(container, ["apple", "banana"], opts);
widget.render();
assert.deepEqual(callback_called, true);
const expected_html = "<div>apple</div><div>banana</div>";
assert.deepEqual(container.appended_data.html(), expected_html);

View File

@@ -203,6 +203,10 @@ exports.create = function ($container, list, opts) {
$container.append($(html));
meta.offset += load_count;
if (opts.callback_after_render) {
opts.callback_after_render();
}
};
widget.render_item = (item) => {

View File

@@ -382,7 +382,6 @@ exports.update_filters_view = function () {
show_selected_filters();
topics_widget.hard_redraw();
revive_current_focus();
};
function stream_sort(a, b) {
@@ -445,8 +444,8 @@ exports.complete_rerender = function () {
},
html_selector: get_topic_row,
simplebar_container: $("#recent_topics_table .table_fix_head"),
callback_after_render: revive_current_focus,
});
revive_current_focus();
};
exports.is_visible = function () {