@Marcelo_Alves wrote:
Hei guys, how are u?
I'm having a hard time to figure it out a solution for my problem. I need return in my email page, only events that have more than one booking inside, and i solve using this piece of code:
export default Route.extend({ model() { return this.store.createRecord('email'); }, setupController(controller, model) { controller.set('model', model); controller.set('events', []); this.store.findAll('event').then(events => { events.forEach(event => { this.store.query('booking', { 'relationships.event.data.id': event.id }).then(bookings => { if (bookings.get('length')) { controller.get('events').pushObject(event); } }); }); }); } });
The problem is: This code is async, so when the user loads the page, first he see's a blank page, than my table with the data appears. I would like to avoid this "flash". Is possible?
Thanks!!
Posts: 1
Participants: 1