Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: loading of session form in wizard step 5 #5843

Merged
merged 11 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions app/routes/events/view/edit/sessions-speakers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classic from 'ember-classic-decorator';
import Route from '@ember/routing/route';
import EventWizardMixin from 'open-event-frontend/mixins/event-wizard';
import { allSettled } from 'rsvp';
import RSVP, { allSettled } from 'rsvp';

@classic
export default class SessionsSpeakersRoute extends Route.extend(EventWizardMixin) {
Expand All @@ -14,7 +14,19 @@ export default class SessionsSpeakersRoute extends Route.extend(EventWizardMixin
const tracksPromise = data.event.get('tracks');
const microlocationsPromise = data.event.get('microlocations');
const sessionTypesPromise = data.event.get('sessionTypes');
const speakersCallPromise = this.getOrCreate(data.event, 'speakersCall', 'speakers-call');
const speakersCallPromise = new RSVP.Promise(async resolve => {
await data.event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't await here, it's useless and will block the loading. Move these statements in another function and await in that function. No await should be there in model function

.get('speakersCall')
.then(relationshipRecord => {
resolve(relationshipRecord);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This then call is redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after removing then, the session page isn't loading

})
.catch(async() => {
const record = await this.store.createRecord('speakers-call', {
event: data.event
});
resolve(record);
});
});
// Only get session/speaker custom forms.
const customFormFilterOptions = [{
or: [
Expand Down
2 changes: 1 addition & 1 deletion app/routes/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class IndexRoute extends Route {
include : 'sessions.track',
'page[size]' : 0
});
const sponsorsPromise = event.query('sponsors', { 'page[size]' : 0 });
const sponsorsPromise = event.query('sponsors', { 'page[size]': 0 });
const taxPromise = event.get('tax');

const [tickets, featuredSpeakers, sponsors, tax] = (await allSettled([ticketsPromise, featuredSpeakersPromise, sponsorsPromise, taxPromise]))
Expand Down