From 51b8d9f3638190ee9b18f05241639a2bc3654aff Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Tue, 29 Apr 2014 12:45:45 +0000
Subject: [PATCH] SSDM-110: Infinite loop bugfix, thanks Kuba!

SVN: 31428
---
 .../as/webapps/newbrowser/html/js/server/ServerFacade.js  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js
index 2d1eb5e7e1c..80875035915 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js
@@ -210,11 +210,13 @@ function ServerFacade(openbisServer) {
 		//
 		// Fix Result List
 		//
+		var visitedSamples = {};
 		function fixSamples(result)
 		{
 			for(var i = 0; i < result.length; i++)
 			{
 				var sampleOrId = result[i];
+				
 				if (isNaN(sampleOrId))
 				{
 					sampleOrId = samplesById[sampleOrId["@id"]];
@@ -223,6 +225,12 @@ function ServerFacade(openbisServer) {
 					sampleOrId = samplesById[sampleOrId]; 
 				}
 				result[i] = sampleOrId;
+				if(visitedSamples[sampleOrId.permId]) {
+					continue;
+				} else {
+					visitedSamples[sampleOrId.permId] = true;
+				}
+				console.log(sampleOrId.code);
 				
 				//Fill Parents
 				if(sampleOrId.parents) {
-- 
GitLab