Missing resolve properties when handle #with with promise
Blaze: 3.0.0 (2.6.1 worked fine but no promise at that time)
Meteor: 3.0.2
Since my migration of my application to Meteor 3.0, I had few bugs and the one I had a hard time to figure out was with the helper #with in conjunction with a helper with promise.
I expect #with to work like a #if but it not quite there.
The code go through the #with once the promise is resolve however it can not resolve the variable inside.
Let's say, I have a helper returning a promise with :
async computed() {
const mycall = await something();
return mycall; // {a: 1, b: 2, c: 3} || null
}
If I use within blaze :
{{#with computed}}
{{a}} // not working
{{computed.a}} // working
{{/with}}
But it defeat my use case of using the with helper.
Thank you @DblK for the report. Can you confirm it already happens in Blaze 2.9.0?
@DblK I also think it's currently not as easy to reolve under the hood as we'd like it to be. Can you think of using the Async States instead? → https://www.blazejs.org/api/spacebars#Async-States
I think it'd actually be trivial now, as it's very similar to how #if works (https://github.com/meteor/blaze/pull/424). I encourage someone to try it themselves, but I can also do that somewhere next week.
Thank you @DblK for the report. Can you confirm it already happens in Blaze 2.9.0?
No I can not. I updated the whole app from my previous version to meteor 3.
@DblK I also think it's currently not as easy to reolve under the hood as we'd like it to be. Can you think of using the Async States instead? → https://www.blazejs.org/api/spacebars#Async-States
I might be able but that means I have to redo/check my whole app and I have too many screens so it does not seems a good solution for me.
I think it'd actually be trivial now, as it's very similar to how
#ifworks (#424). I encourage someone to try it themselves, but I can also do that somewhere next week.
Thanks for pointing out. My guess was that it should be similar to #if so I will have a look at it.