From 0684886e473fdfb862eca72843862c4aa8b0db7c Mon Sep 17 00:00:00 2001
From: Piotr Gawron <p.gawron@atcomp.pl>
Date: Fri, 7 Mar 2025 10:22:33 +0100
Subject: [PATCH] passing invalid overlay in the url params threw an error

---
 CHANGELOG                                            | 5 +++++
 src/redux/overlayBioEntity/overlayBioEntity.thunk.ts | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 64fd5d06..7ef775f0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+minerva-front (18.2.0) stable; urgency=medium
+  * Bug fix: passing invalid overlay in the url params threw an error (#353)
+
+-- Piotr Gawron <piotr.gawron@uni.lu>  Thu, 06 Mar 2025 17:00:00 +0200
+
 minerva-front (18.1.1) stable; urgency=medium
   * Bug fix: styling of notes reset only for a href (#334)
   * Bug fix: disable searching for chemicals in projects without disease (#347)
diff --git a/src/redux/overlayBioEntity/overlayBioEntity.thunk.ts b/src/redux/overlayBioEntity/overlayBioEntity.thunk.ts
index f726bd8f..001dc752 100644
--- a/src/redux/overlayBioEntity/overlayBioEntity.thunk.ts
+++ b/src/redux/overlayBioEntity/overlayBioEntity.thunk.ts
@@ -5,6 +5,7 @@ import { OverlayBioEntityRender } from '@/types/OLrendering';
 import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus';
 import { ThunkConfig } from '@/types/store';
 import { getError } from '@/utils/error-report/getError';
+import { showToast } from '@/utils/showToast';
 import {
   getValidOverlayBioEntities,
   parseOverlayBioEntityToOlRenderingFormat,
@@ -101,9 +102,13 @@ export const getInitOverlays = createAsyncThunk<
 
       if (eventData) {
         PluginsEventBus.dispatchEvent('onShowOverlay', eventData);
+        dispatch(getOverlayBioEntityForAllModels({ overlayId: id }));
+      } else {
+        showToast({
+          type: 'error',
+          message: `Overlay passed in the url does not exist (overlayId: ${id})`,
+        });
       }
-
-      dispatch(getOverlayBioEntityForAllModels({ overlayId: id }));
     });
   } catch (error) {
     return Promise.reject(getError({ error, prefix: INIT_OVERLAYS_ERROR_PREFIX }));
-- 
GitLab