@Scott_Newcomer wrote:
This component handles a bunch of different shapes of arrays. plain array, promise, promise proxy, plain array with promises in it (which can be filtered). Some details hidden, but in
init
, it tries to render the collection (if plain array) as fast as possible (fastboot) and when the browser takes over then create gallery indidInsertElement
(since usingdocument.querySelector
).init() { // Because we may need to access a promisified object in the template, we need // to resolve before handing off this.get('promisifiedItems') .then(resolvedItems => this.set('resolvedItems', filterRejected(resolvedItems))) .catch(() => this.set('hasErrored', true)) .finally(() => this.set('isDoneLoading', true)); }, didInsertElement() { // next only works, scheduleOnce is too early scheduleOnce('afterRender', this, () => { this.get('promisifiedItems').then(() => { createGallery(); // grabs each painted item and attaches css transformations }); }); }
In a simple test I have, resolvedItems is set before didInsertElement but I can’t use scheduleOnce because resolvedItems has yet to paint. Want it to happen on a tight as schedule as possible so wanted to ask - is this expected (Ember 3.7) and is there some rules about the run loop, setters and painting to glean from this?
Posts: 1
Participants: 1