Skip to content

Commit 11b6b36

Browse files
fix: Preserve scrolling position while filtering sessions (#5878)
Co-authored-by: akash2408 <aakash20012408@gmail.com> Co-authored-by: Akash Deep <61289472+akash2408@users.noreply.github.com>
1 parent 308d268 commit 11b6b36

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

app/controllers/public/sessions.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import classic from 'ember-classic-decorator';
2-
import { action, computed } from '@ember/object';
2+
import { computed } from '@ember/object';
33
import Controller from '@ember/controller';
44
import moment from 'moment';
5-
import $ from 'jquery';
65

76
@classic
87
export default class SessionsController extends Controller {
@@ -11,21 +10,7 @@ export default class SessionsController extends Controller {
1110
sort = 'starts-at';
1211
isTrackVisible = false;
1312
timezone = null;
14-
15-
constructor(...args) {
16-
super(...args);
17-
18-
this.addObserver('model.session', this, 'sessionChanged');
19-
}
20-
21-
@action
22-
sessionChanged() {
23-
if (this.model.isFiltering) {
24-
$('html,body').animate({
25-
scrollTop: $('#session-heading').offset()?.top
26-
});
27-
}
28-
}
13+
preserveScrollPosition = true;
2914

3015
@computed('model.event.startsAt', 'model.event.endsAt', 'timezone')
3116
get allDates() {

app/routes/public/sessions.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ export default class SessionsRoute extends Route {
8787
});
8888
}
8989

90-
const isFiltering = params.room || params.track || params.date;
91-
9290
return {
9391
event : eventDetails,
9492
session : await this.infinity.model('sessions', {
@@ -100,8 +98,7 @@ export default class SessionsRoute extends Route {
10098
perPageParam : 'page[size]',
10199
pageParam : 'page[number]',
102100
store : eventDetails
103-
}),
104-
isFiltering
101+
})
105102
};
106103
}
107104
}

0 commit comments

Comments
 (0)