mirror of
https://github.com/flarum/framework.git
synced 2025-06-24 11:41:22 +08:00
Don't clear the discussion list when loading new results
This commit is contained in:
@ -5,6 +5,7 @@ import app from 'flarum/app';
|
|||||||
import DiscussionList from 'flarum/components/DiscussionList';
|
import DiscussionList from 'flarum/components/DiscussionList';
|
||||||
import DiscussionPage from 'flarum/components/DiscussionPage';
|
import DiscussionPage from 'flarum/components/DiscussionPage';
|
||||||
import IndexPage from 'flarum/components/IndexPage';
|
import IndexPage from 'flarum/components/IndexPage';
|
||||||
|
import Button from 'flarum/components/Button';
|
||||||
|
|
||||||
app.initializers.add('pusher', () => {
|
app.initializers.add('pusher', () => {
|
||||||
const loadPusher = m.deferred();
|
const loadPusher = m.deferred();
|
||||||
@ -52,16 +53,20 @@ app.initializers.add('pusher', () => {
|
|||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
vdom.children.unshift(
|
vdom.children.unshift(
|
||||||
<button className="Button Button--block DiscussionList-update"
|
Button.component({
|
||||||
onclick={() => {
|
className: 'Button Button--block DiscussionList-update',
|
||||||
app.pushedUpdates = [];
|
onclick: () => {
|
||||||
this.refresh();
|
this.refresh(false).then(() => {
|
||||||
}}
|
this.loadingUpdated = false;
|
||||||
config={(element, isInitialized) => {
|
app.pushedUpdates = [];
|
||||||
if (!isInitialized) $(element).hide().fadeIn();
|
app.setTitleCount(0);
|
||||||
}}>
|
m.redraw();
|
||||||
{app.trans('pusher.show_updated_discussions', {count})}
|
});
|
||||||
</button>
|
this.loadingUpdated = true;
|
||||||
|
},
|
||||||
|
loading: this.loadingUpdated,
|
||||||
|
children: app.trans('pusher.show_updated_discussions', {count})
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user