Re: Promise resolution handler fires before synchronous constructor stack has finished.

2019-07-28 Thread Jordan Harband
No, that's not accurate - every `.then` always executes on a future tick, never synchronously. On Sat, Jul 27, 2019 at 11:11 PM Ranando King wrote: > Isn't it always the case that `Promise.resolve()` returns an immediately > resolved Promise? That means that the `.then` clause would get

Re: Promise resolution handler fires before synchronous constructor stack has finished.

2019-07-28 Thread Jordan Harband
When I run this in a node repl, that's exactly what happens - perhaps your simplified example has simplified out the bug? On Sat, Jul 27, 2019 at 6:57 PM #!/JoePea wrote: > I feel like I'm going crazy, but I have a class hierarchy, and one of > the constructors in the hierarchy defers some

Re: Promise resolution handler fires before synchronous constructor stack has finished.

2019-07-28 Thread Ranando King
Isn't it always the case that `Promise.resolve()` returns an immediately resolved Promise? That means that the `.then` clause would get executed immediately as well, which is before you have a chance to set `this.foo`. Seems like what you need to do is something more like this: ```js // class Foo