These are chat archives for ractivejs/ractive

25th
Jan 2018
Juan C. Andreu
@andreujuanc
Jan 25 2018 00:24
Have any of you guys tried this before??
Martin Kolárik
@MartinKolarik
Jan 25 2018 00:28
no but planning to
Chris Reeves
@evs-chris
Jan 25 2018 00:35
have they added plugins yet or did I just miss that they've been available all along?
Joseph
@fskreuz
Jan 25 2018 02:10
Haven't tried, but was looking for something similar recently.
Paul Maly
@PaulMaly_twitter
Jan 25 2018 20:13

@evs-chris Seems, we need to be able to do that:

{{#await foo}}
{{then res, err}}
<deduping markup />
{{/await}}

It reminds me this foo.then(handler, handler)

Is it possible?
Very cool way, if we'll also be able to have cached res value from previous success.
Chris Reeves
@evs-chris
Jan 25 2018 20:17
so you handle res and err in the same way?
Paul Maly
@PaulMaly_twitter
Jan 25 2018 20:17
not completely the same, but too many shared markup
right now I faced with this case

Very cool way, if we'll also be able to have cached res value from previous success.

more detail about this one:

{{#await foo}}
{{then res, err}}
     {{#if err}} Seems connection problems...{{/if}}
     Result: {{res}}
{{/await}}

setInterval(() => {
        this.set('foo', fetch('/something'));
}, 1000);
Paul Maly
@PaulMaly_twitter
Jan 25 2018 20:27
If it hard or impossible, seems we could to neglect it, because maybe it's too narrow case
Chris Reeves
@evs-chris
Jan 25 2018 20:28
did we miss {{#await foo then res}}?
and yes, having previous values is possible, but not in the same binding
Paul Maly
@PaulMaly_twitter
Jan 25 2018 20:29

did we miss {{#await foo then res}}?

loading?

Chris Reeves
@evs-chris
Jan 25 2018 20:29
also, that seems like it would be better handled out the template generally
skip the loading
Paul Maly
@PaulMaly_twitter
Jan 25 2018 20:30
maybe use {{else}} for this?
somehow
Chris Reeves
@evs-chris
Jan 25 2018 20:30
I was going on svelte syntax
I think
Paul Maly
@PaulMaly_twitter
Jan 25 2018 20:31
yep, and it's good, but not ideal
{{#await foo as res, err}}
     {{#if res}}
        Result: {{res}}
     {{elseif err}}
        Error: {{err}}
     {{else}}
        Loading....
     {{/if}}
{{else}}
No foo
{{/await}}
don't cover prev value, but main case looks simpler
then => as (to consistency)
Also seems it's more flexible than separated blocks, especially markup things
Joseph
@fskreuz
Jan 25 2018 23:15
Hmm...
{{#partial sharedtemplate }} ... {{/partial}}

{{#await foo}}
{{then res}}
  {{> sharedtemplate }}
{{catch e }}
  {{> sharedtemplate }}
{{/await}}