Skip to content

Commit f3b8e68

Browse files
author
Hieu Lam - TMA
authored
feature-8742: sortedSpeakers variable mutation issue happened at certain event (#9013)
1 parent 9faec63 commit f3b8e68

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

app/components/public/session-item.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{!-- template-lint-disable no-nested-interactive --}}
2-
<UiAccordion class="segment p-0" style={{css background-color=@session.track.color border-color='lightgray'}}>
2+
<UiAccordion class="segment p-0" style={{css background-color=@session.track.color border-color='lightgray'}} {{did-insert this.setUpComponent}}>
33
<div class="title p-4 pr-1" {{action 'hideSpeakerImage'}} role="button" style={{css color=(text-color @session.track.color)}}>
44
<div class="ui">
55
<h3 class="ui header d-flex" id="session-id-{{@session.id}}" style={{css color=(text-color @session.track.color)}}>

app/components/public/session-item.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export default class SessionItem extends Component {
1616
@tracked
1717
hideImage = this.args.expanded;
1818

19+
@tracked
20+
sortedSpeakers = [];
21+
1922
get youtubeLink() {
2023
return extractYoutubeUrl(this.args.session.videoUrl);
2124
}
@@ -25,8 +28,9 @@ export default class SessionItem extends Component {
2528
return url.startsWith('https://open-event-api-dev.herokuapp.com') || url.startsWith('https://api.eventyay.com');
2629
}
2730

28-
get sortedSpeakers() {
29-
const { speakers } = this.args.session;
31+
@action
32+
async setUpComponent(){
33+
const { speakers } = await this.args.session;
3034
const sortedSpeakers = {};
3135
const sessionId = this.args.session.id;
3236
let count = 0;
@@ -37,7 +41,7 @@ export default class SessionItem extends Component {
3741
}
3842
});
3943
Object.fromEntries(Object.entries(sortedSpeakers).sort());
40-
return count === speakers.length ? Object.values(sortedSpeakers) : speakers;
44+
this.sortedSpeakers = count === speakers.length ? Object.values(sortedSpeakers) : speakers;
4145
}
4246

4347
get sessionEnded() {

app/components/schedule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class Schedule extends Component<ScheduleArgs> {
6262
}
6363

6464
get resources() { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
65-
return this.args.rooms.map(room => ({ id: room.id, title: room.name }));
65+
return this.args.rooms?.map(room => ({ id: room.id, title: room.name }));
6666
}
6767

6868
get events() { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types

app/controllers/events/view/scheduler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class extends Controller {
1111

1212
@computed('model.microlocations')
1313
get microlocations() {
14-
return this.model.microlocations.sortBy('position').filter(x => !x.hiddenInScheduler);
14+
return this.model.microlocations?.sortBy('position').filter(x => !x.hiddenInScheduler);
1515
}
1616

1717
@computed('model.unscheduled', 'filter')

0 commit comments

Comments
 (0)