mirror of
https://github.com/flarum/core.git
synced 2025-07-12 04:16:24 +02:00
Clean up app.current, app.previous in JS (#2156)
- Encapsulate app.current, app.previous in PageState objects - Reorganize Page classes to use one central base class in common Co-authored-by: Franz Liedke <franz@develophp.org>
This commit is contained in:
committed by
GitHub
parent
88366fe8af
commit
71e313e677
@ -1,5 +1,5 @@
|
||||
import { extend } from '../../common/extend';
|
||||
import Page from './Page';
|
||||
import Page from '../../common/components/Page';
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
import listItems from '../../common/helpers/listItems';
|
||||
import DiscussionList from './DiscussionList';
|
||||
@ -25,15 +25,15 @@ export default class IndexPage extends Page {
|
||||
// If the user is returning from a discussion page, then take note of which
|
||||
// discussion they have just visited. After the view is rendered, we will
|
||||
// scroll down so that this discussion is in view.
|
||||
if (app.previous instanceof DiscussionPage) {
|
||||
this.lastDiscussion = app.previous.discussion;
|
||||
if (app.previous.matches(DiscussionPage)) {
|
||||
this.lastDiscussion = app.previous.get('discussion');
|
||||
}
|
||||
|
||||
// If the user is coming from the discussion list, then they have either
|
||||
// just switched one of the parameters (filter, sort, search) or they
|
||||
// probably want to refresh the results. We will clear the discussion list
|
||||
// cache so that results are reloaded.
|
||||
if (app.previous instanceof IndexPage) {
|
||||
if (app.previous.matches(IndexPage)) {
|
||||
app.discussions.clear();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user