diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts
index 7b520adcd5668e283242060d398c12436cc42db5..4e2beb66e3813a3cee748902d0327ba974fde856 100755
--- a/src/frontend/app/list/basket-list.component.ts
+++ b/src/frontend/app/list/basket-list.component.ts
@@ -239,11 +239,13 @@ export class BasketListComponent implements OnInit {
     togglePanel(mode: string, row: any) {
         let thisSelect = { checked : true };
         let thisDeselect = { checked : false };
+        const previousRes = this.currentResource;
         row.checked = true;
+
         this.toggleAllRes(thisDeselect);
         this.toggleRes(thisSelect, row);
-
-        if(this.currentResource.resId == row.resId && this.sidenavRight.opened && this.currentMode == mode) {
+        
+        if(previousRes.resId == row.resId && this.sidenavRight.opened && this.currentMode == mode) {
             this.sidenavRight.close();
         } else {
             this.currentMode = mode;