InstantSearch Load More replaces content instead of loading content

Hi,

The Load More button on the Products indice section loads next set of results by replacing the previuos like a navigation. The Load More button on the Turtips indice section loads correctly by loading the next set of results by adding it after the previous.

I am missing something here. Does anyone know what I am missing here? The test site is https://speidersport.staging.wpengine.com/?s=speider&is_v=1

The JavScript code can be seen here:

jQuery(function() {
	if(jQuery('#algolia-search-box').length > 0) {

		if (algolia.indices.searchable_posts === undefined && jQuery('.admin-bar').length > 0) {
			alert('It looks like you haven\'t indexed the searchable posts index. Please head to the Indexing page of the Algolia Search plugin and index it.');
		}

		/* Instantiate Products search with connection to Posts search for a connection with only one Searchbox  */
		var products = instantsearch({
			appId: algolia.application_id,
			apiKey: algolia.search_api_key,
			indexName: algolia.indices.posts_product.name,
			urlSync: {
				mapping: {'q': 's'},
				trackedParameters: ['query']
			},
			searchFunction: function(helper){
				var query = products.helper.state.query;
				var searchResults = jQuery('#algolia-main-area');
				var searchSidebar = jQuery('#algolia-sidebar-area');
				
				// Set default query in the breadcrumbs
				jQuery('span#search-query').html('<?php echo __('Alt', 'speider'); ?>');

				// Empty query string -> hide the search results & abort the search
				if(query == ''){
					searchResults.hide();
					searchSidebar.hide();
					return;
				}
				else{
					// Create new breadcrumb with the query
					jQuery('span#search-query').html(query);
				}

				// Save both the query & the page number
				var oldPostsPage = posts.helper.state.page;
				var oldPostsQuery = posts.helper.state.query;

				// Will reset the page number
				posts.helper.setQuery(query);

				// The query didn't change so we need to reapply the current page
				if (query === oldPostsQuery) {
					posts.helper.setPage(oldPostsPage);
				}
				
				// Start the searches and display the searches
				posts.helper.search();
				helper.search();
				searchResults.show();
				searchSidebar.show();

			},
			searchParameters: {
				facetingAfterDistinct: true,
				highlightPreTag: '<em>',
				highlightPostTag: '</em>'
			}
		});

		/* Set Posts search for the connection with Products to work with only one Searchbox  */
		var posts = instantsearch({
			appId: algolia.application_id,
			apiKey: algolia.search_api_key,
			indexName: algolia.indices.posts_post.name,
			searchParameters: {
				facetingAfterDistinct: true,
				highlightPreTag: '<em>',
				highlightPostTag: '</em>'
			}
		});

		/* Create the Searchbox settings */
		var searchBox = instantsearch.widgets.searchBox({
			container: '#algolia-search-box',
			placeholder: <?php echo __('"Søk etter produkter eller turtips"', 'speider'); ?>,
			wrapInput: false,
			autofocus: false
		});

		/********************************************************
			* PRODUCTS SETTINGS
			*******************************************************/

		/* Create the total count of returned objects of Products the search settings */
		var productsCount = instantsearch.widgets.stats({
			container: '#algolia-products-count',
			templates: {
				body:  "<strong>{{nbHits}}</strong> " + <?php echo __('"søkeresultater for <strong>\'{{query}}\'</strong>  i produkter:"', 'speider'); ?>
			}
		});

		/* Create the Products Hit settings */
		var productsHits = instantsearch.widgets.infiniteHits({
			container: '#algolia-products',
			escapeHits: true,
			hitsPerPage: 5,
			showMoreLabel: <?php echo __('"Se mer produkter"', 'speider'); ?>,
			templates: {
				allItems: wp.template('products'),
				empty: <?php echo __('"Ingen resultater for"', 'speider'); ?> + " <strong>\'{{query}}\'</strong>",
			}
		});

		/* Create the Products navigation */
		var productsNavigation = instantsearch.widgets.pagination({
			container: '#algolia-products-pagination',
			scrollTo: '#algolia-products-container',
			showFirstLast: false,
			labels: {
				previous: '&larr;',
				next: '&rarr;'
			},
			cssClasses: {
				root: ['page-numbers']
			},
		});

		/* Create the Products Categories in Sidebar settings */
		var productsCategories = instantsearch.widgets.hierarchicalMenu({
			container: '#algolia-products-categories',
			separator: ' > ',
			sortBy: ['count'],
			attributes: ['taxonomies_hierarchical.product_cat.lvl0', 'taxonomies_hierarchical.product_cat.lvl1', 'taxonomies_hierarchical.product_cat.lvl2'],
			templates: {
				header: '<h3 class="widgettitle">' + <?php echo __('"Treff på kategorier"', 'speider'); ?> + '</h3>'
			}
		});

		/* Create the Products Brands in Sidebar settings */
		var productsBrands = instantsearch.widgets.hierarchicalMenu({
			container: '#algolia-products-brands',
			separator: ' > ',
			sortBy: ['count'],
			attributes: ['taxonomies_hierarchical.brand.lvl0', 'taxonomies_hierarchical.product_cat.lvl1', 'taxonomies_hierarchical.product_cat.lvl2'],
			templates: {
				header: '<h3 class="widgettitle">' + <?php echo __('"Treff på merkeverarer"', 'speider'); ?> + '</h3>'
			}
		});

		/* Create the Posts Tags in Sidebar settings */
		var productsTags = instantsearch.widgets.hierarchicalMenu({
			container: '#algolia-products-tags',
			separator: ' > ',
			sortBy: ['count'],
			attributes: ['taxonomies.product_tag'],
			templates: {
				header: '<h3 class="widgettitle">' + <?php echo __('"Treff på egenskaper"', 'speider'); ?> + '</h3>'
			}
		});

		/********************************************************
			* POSTS SETTINGS
			*******************************************************/

		/* Create the total count of returned objects of Posts of the search settings */
		var postsCount = instantsearch.widgets.stats({
			container: '#algolia-posts-count',
			templates: {
				body:  "<strong>{{nbHits}}</strong> " + <?php echo __('"søkeresultater for <strong>\'{{query}}\'</strong> i turtips:"', 'speider'); ?>
			}
		});

		/* Create the Posts Hit settings */
		var postsHits = instantsearch.widgets.infiniteHits({
			container: '#algolia-posts',
			escapeHits: true,
			hitsPerPage: 6,
			showMoreLabel: <?php echo __('"Se mer turtips"', 'speider'); ?>,
			cssClasses: {
				root: ['page-articles'],
				item: ['article']
			},
			templates: {
				item: wp.template('posts'),
				empty: '',
			}
		});

		/* Create the Posts navigation */
		var postsNavigation = instantsearch.widgets.pagination({
			container: '#algolia-posts-pagination',
			scrollTo: '#algolia-posts-container',
			showFirstLast: false,
			labels: {
				previous: '&larr;',
				next: '&rarr;'
			},
			cssClasses: {
				root: ['page-numbers']
			},
		});
		
		/* Create the Posts Categories in Sidebar settings */
		var postsCategories = instantsearch.widgets.hierarchicalMenu({
			container: '#algolia-posts-categories',
			separator: ' > ',
			sortBy: ['count'],
			attributes: ['taxonomies_hierarchical.category.lvl0', 'taxonomies_hierarchical.category.lvl1', 'taxonomies_hierarchical.category.lvl2'],
			templates: {
				header: '<h3 class="widgettitle">' + <?php echo __('"Turtips kategorier"', 'speider'); ?> + '</h3>'
			}
		});

		/* Create the Posts Tags in Sidebar settings */
		var postsTags = instantsearch.widgets.hierarchicalMenu({
			container: '#algolia-posts-tags',
			separator: ' > ',
			sortBy: ['count'],
			attributes: ['taxonomies.post_tag'],
			templates: {
				header: '<h3 class="widgettitle">' + <?php echo __('"Turtips egenskaper"', 'speider'); ?> + '</h3>'
			}
		});

		/********************************************************
			* ALL WIDGETS INITIATING
			*******************************************************/

		/* Create the wdigets for all Products */
		products.addWidget(searchBox);
		products.addWidget(productsCount);
		products.addWidget(productsHits);
		//products.addWidget(productsNavigation);
		products.addWidget(productsCategories);
		products.addWidget(productsBrands);
		products.addWidget(productsTags);
		
		/* Create the widgets for all Posts */
		posts.addWidget(postsHits);
		posts.addWidget(postsCount);
		//posts.addWidget(postsNavigation);
		posts.addWidget(postsCategories);
		posts.addWidget(postsTags);

		/* START the search and make it work */
		posts.start();
		products.start();

		jQuery('#algolia-search-box input').attr('type', 'search').select();
	}
});

Best regards.

I solved it. The problem was this part that I had in the var productHits defined the templates attribute allItems because I used a navigation before. When I changed the allItems to item it turned out that the infiniteHits funciton could work properly.