I tried to insert <div>
containers around the {{#each}} but it didn't work as well. Its also odd because it works for 2 normal posts list pages, but not for the 3rd one which sorts them by distance.
Updates:
I noticed that after i change the template JS from template.name.onRendered
to onCreated
, the sorting page works. However it works only if you go from a previous post list page and not from the profile page.
The only common ground of the error pages is those pages use publishComposite for sorting. Could that be the issue since publishComposite has a child to parent relationship?
The 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 referred to 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;
}
The relevant html
{{#ionView}}
{{#ionContent}}
{{#ionList}}
<div>
{{#each shops}}
{{> shopItem}}
{{/each}}
</div>
{{/ionList}}
{{/ionContent}}
{{/ionView}}
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'll make explaination if this work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With