Skip to content

Commit

Permalink
Enable scroll/reset on route for the source list panel (#62 #106)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Aug 20, 2020
1 parent 11baf89 commit 9f12806
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion frontend/src/aspects/exploration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import mainRouter from '../global/main-router';
import explorer from '../global/explorer-view';
import controller from '../global/explorer-controller';
import { ensureSources } from '../global/sources';
import sourceListPanel from '../global/source-list-view';

const browserHistory = window.history;

Expand Down Expand Up @@ -39,7 +40,15 @@ channel.on('currentRoute', (route, panel) => {
browserHistory.replaceState(panel.cid, document.title);
});

mainRouter.on('route:explore', () => ensureSources());
mainRouter.on('route:explore', () => {
ensureSources();
const cid = sourceListPanel.cid;
if (explorer.has(cid)) {
explorer.scroll(cid);
} else {
explorer.reset(sourceListPanel);
}
});

router.on('route', (route, [serial]) => {
const state = browserHistory.state;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/global/explorer-view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import View from '../core/view';
import ExplorerView from '../explorer/explorer-view';
import sourceListView from '../global/source-list-view';

export default new ExplorerView({ first: sourceListView });
export default new ExplorerView({ first: new View() });

0 comments on commit 9f12806

Please sign in to comment.