These are chat archives for canjs/canjs

12th
Sep 2018
^^ New can-route is out which makes using it much easier thanks to DefineMap.
No more serialize: false!!!
Gregg Roemhildt
@roemhildtg
Sep 12 2018 19:48
Question - in the newest can-stache does #with still create a new scope?
I know #for of does not
Kevin Phillips
@phillipskevin
Sep 12 2018 20:21
#with does, yes
we're going to add a #let helper that can be used like #with but without creating a new scope
Gregg Roemhildt
@roemhildtg
Sep 12 2018 20:25
That'll be nice and easy
Kevin Phillips
@phillipskevin
Sep 12 2018 20:27
that bug you found yesterday is fixed now also: https://github.com/canjs/can-view-scope/releases/tag/v4.8.1
Gregg Roemhildt
@roemhildtg
Sep 12 2018 20:27
:+1:
Sweet!
Kevin Phillips
@phillipskevin
Sep 12 2018 20:27
if you haven't converted all of your templates to for...of already, you should be able to update
Gregg Roemhildt
@roemhildtg
Sep 12 2018 20:27
Working on it :P
Regexpressions work pretty well
There's a bit of manual stuff involved with the scope changes
Kevin Phillips
@phillipskevin
Sep 12 2018 20:28
if you want to write a codemod, that would be awesome
ah, yeah
Gregg Roemhildt
@roemhildtg
Sep 12 2018 20:28
Not sure how I'd code mod that. There's lots of odd cases where you want to keep the scope.vm.stuff
like can-template
Gregg Roemhildt
@roemhildtg
Sep 12 2018 20:45
What about this situation? I actually want the "this" value to become the value of toast, because my child renderer template expects that.
<can-import from="spectre-canjs/sp-toast/sp-toast.stache" value:to="scope.vars.toast" />
<div class="toasts">
    {{#for(toast of toasts)}}
        {{#with(toast)}}
        {{>scope.vars.toast}}
        {{/with}}
    {{/for}}
</div>
Is there a better way to do that?
Gregg Roemhildt
@roemhildtg
Sep 12 2018 21:01
Thanks @phillipskevin That did fix the issue I was having
I'm also seeing another error in can-view-nodelist
    replace: function (oldElements, newFrag) {
        // The following helps make sure that a selected <option> remains
        // the same by removing `selected` from the currently selected option
        // and adding selected to an option that has the same value.
        var selectedValue,
            parentNode = oldElements[0].parentNode;

        if(parentNode.nodeName.toUpperCase()
The error is because "parentNode" is undefined
Gregg Roemhildt
@roemhildtg
Sep 12 2018 21:20
Got any ideas on that one? The oldElements array just contains a text node that is empty.
Gregg Roemhildt
@roemhildtg
Sep 12 2018 21:41
Error is occuring in an if statement when a value gets set:
{{#if(projectsPromise.isPending)}}
    <div class="loading"></div>
{{else}}
    <dl-autocomplete 
        options:from="autoCompleteOptions"
        on:value="setSelectedSearch(scope.arguments.0.0)"></dl-autocomplete>

    {{#if(selectedProject)}}
        Error occurs here when selectedProject gets set
    {{/if}}

{{/if}}
Kevin Phillips
@phillipskevin
Sep 12 2018 21:53
is that the top-level of the template?
Gregg Roemhildt
@roemhildtg
Sep 12 2018 21:54
Yes
Kevin Phillips
@phillipskevin
Sep 12 2018 21:54
if you wrap it in a <div> does the error go away?
might be related to canjs/can-stache#202
Gregg Roemhildt
@roemhildtg
Sep 12 2018 21:56
Nope. Still happens
Kevin Phillips
@phillipskevin
Sep 12 2018 21:57
what is oldElements[0]?
Gregg Roemhildt
@roemhildtg
Sep 12 2018 21:58
image.png
A bit up the call stack
image.png
Kevin Phillips
@phillipskevin
Sep 12 2018 22:02
what if you wrap Error occurs here when selectedProject gets set in an element?
Gregg Roemhildt
@roemhildtg
Sep 12 2018 22:04
Nope
Kevin Phillips
@phillipskevin
Sep 12 2018 22:04
ok, if you can reproduce it in a codepen I can take a look
later tonight / tomorrow morning