Error: Failed to execute 'insertBefore' in 'Node'

I tried to insert <div> containers around {{#each}}, but that didn't work. Its also weird because it works for two pages of a list of standard messages, but not for the third, which sorts them by distance.

Updates: I noticed that after changing the JS template.name.onRendered from template.name.onRendered to onCreated , the sorting page works. However, it only works if you go from the previous page of the message list, and not from the profile page.

The only common ground for error pages is that these pages use publishComposite to sort. Could this be a problem since publishComposite has child relationships with parent relationships?

Error message

 Exception in queued task: Error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. at Error (native) at Object.container._uihooks.insertElement (http://localhost:3000/packages/meteoric_ionic.js?e45c114e85716d9fad8bac1cd7904ae2700bc963:5750:19) at DOMRange._insertNodeWithHooks (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:383:21) at Function.Blaze._DOMRange._insertNodeWithHooks (http://localhost:3000/packages/peerlibrary_blaze-components.js?4eddb4e3f0f660190548347e680d109a51a7050f:2377:10) at Function.DOMRange._insert (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:354:16) at DOMRange.attach (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:431:16) at Blaze._DOMRange.attach (http://localhost:3000/packages/peerlibrary_blaze-components.js?4eddb4e3f0f660190548347e680d109a51a7050f:2437:33) at Function.DOMRange._insert (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:349:7) at DOMRange.attach (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:431:16) at Blaze._DOMRange.attach (http://localhost:3000/packages/peerlibrary_blaze-components.js?4eddb4e3f0f660190548347e680d109a51a7050f:2437:33) 

The meteoric_ionic js file is on line 19

 container._uihooks = { insertElement: function(node, next) { var $node = $(node); if (!template.transition || !$node.hasClass('view') || IonNavigation.skipTransitions) { container.insertBefore(node, next); //line 19 return; } 

Corresponding html

  {{#ionView}} {{#ionContent}} {{#ionList}} <div> {{#each shops}} {{> shopItem}} {{/each}} </div> {{/ionList}} {{/ionContent}} {{/ionView}} 
+5
source share
1 answer

Try this and let me know:

 Template.nearShops.onCreated(function () { var self = this; self.autorun(function () { self.interval = Meteor.setInterval(function(){ var currentLocation = Geolocation.latLng() || ''; if(currentLocation) { Session.set('lat', currentLocation.lat); Session.set('lng', currentLocation.lng); } }, 2000); }); self.autorun(function(){ if(Session.get('lat')) { self.subscribe( "nearShops", Session.get('lng'), Session.get('lat') ); } }); }); 

I will explain if this work

+3
source

Source: https://habr.com/ru/post/1241516/


All Articles