Canjs4: crashes calling helpers withing partialName stache


#1

I’d like to describe what seems like a bug to me, maybe someone can explain, maybe a bug report should follow. We’re using canjs4 + stealjs on linux.

{{<componentPartial}}
{{#is(scope.root.currentPage(), ‘some_page_name’)}}

{{else}}

{{/is}}
{{/componentPartial}}

{{#constructor.pageData[currentPage()]}}
{{>componentPartial}}
{{/constructor.pageData}}

When using #is or #switch constructs within the named partial feature (https://canjs.com/doc/can-stache.tags.named-partial.html), AND one of the args is a function call, this causes crashes & reloads of our app.

When replacing the function call in the #is / #switch with a variable there are no crashes.
When moving the code (with function calls in #is / #switch) from the named partial to the #constructor … part, ie eliminating the use of the named partial, no crashes occur.

Here’s the error stack when crashes occur:

VM2159251 node.js:77 Uncaught DOMException: Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of this node.
at HTMLElement.normal.(anonymous function) (http:///node_modules/can-dom-mutate/node.js:77:27)
at Object.remove (http:///node_modules/can-view-nodelist/can-view-nodelist.js:485:26)
at Object.replace (http:///node_modules/can-view-nodelist/can-view-nodelist.js:464:14)
at CompletionQueue.flush (http:///node_modules/can-queues/completion-queue.js:22:12)
at Object.onComplete (http:///node_modules/can-queues/can-queues.js:44:16)
at PriorityQueue.flush (http:///node_modules/can-queues/priority-queue.js:120:19)
at Object.onComplete (http:///node_modules/can-queues/can-queues.js:30:16)
at Queue.flush (http:///node_modules/can-queues/queue.js:55:17)
at Object.stop (http:///node_modules/can-queues/can-queues.js:92:19)
at PushstateObservable.can-route.updateRouteData (http:///node_modules/can-route/can-route.js:98:15)
normal.(anonymous function) @ VM2159251 node.js:77
remove @ VM2159261 can-view-nodelist.js:485
replace @ VM2159261 can-view-nodelist.js:464
CompletionQueue.flush @ VM2159280 completion-queue.js:22
onComplete @ VM2159274 can-queues.js:44
PriorityQueue.flush @ VM2159279 priority-queue.js:120
onComplete @ VM2159274 can-queues.js:30
Queue.flush @ VM2159276 queue.js:55
stop @ VM2159274 can-queues.js:92
can-route.updateRouteData @ VM2159411 can-route.js:98
Queue.flush @ VM2159276 queue.js:51
onComplete @ VM2159274 can-queues.js:53
CompletionQueue.flush @ VM2159280 completion-queue.js:27
onComplete @ VM2159274 can-queues.js:44
PriorityQueue.flush @ VM2159279 priority-queue.js:120
onComplete @ VM2159274 can-queues.js:30
Queue.flush @ VM2159276 queue.js:55
stop @ VM2159274 can-queues.js:92
enqueueByQueue @ VM2159274 can-queues.js:126
dispatchHandlers @ VM2159410 can-route-pushstate.js:130
window.history.(anonymous function) @ VM2159410 can-route-pushstate.js:221
anchorClickHandler @ VM2159410 can-route-pushstate.js:187
PushstateObservable.anchorClickHandler @ VM2159410 can-route-pushstate.js:74
(anonymous) @ VM2159298 -make-delegate-event-tree.js:33
(anonymous) @ VM2159298 -make-delegate-event-tree.js:32
(anonymous) @ VM2159246 shape.js:446
eachListLike @ VM2159246 shape.js:377
eachIndex @ VM2159246 shape.js:339
eachKey @ VM2159246 shape.js:444
each @ VM2159246 shape.js:310
handler.delegated.(anonymous function) @ VM2159298 -make-delegate-event-tree.js:24
VM2159041 panel-beam-coverage-viewmodel.js!eval:29 inserted panel-beam-coverage
VM2159041 panel-beam-coverage-viewmodel.js!eval:87 rendering panel-beam-coverage globe…
VM2159041 panel-beam-coverage-viewmodel.js!eval:99 75 2427 231 829


#2

Please update your dependencies to latest. I recently fixed this.


#3