From d395b1c8e208245f6b97e28bbc96ef2fc17fdcf9 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <p.gawron@atcomp.pl> Date: Thu, 19 Sep 2024 13:22:57 +0200 Subject: [PATCH] loading should appear until overlay data for current model are not available --- .../overlayBioEntity.selector.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/redux/overlayBioEntity/overlayBioEntity.selector.ts b/src/redux/overlayBioEntity/overlayBioEntity.selector.ts index 2b96a538..b1276a7c 100644 --- a/src/redux/overlayBioEntity/overlayBioEntity.selector.ts +++ b/src/redux/overlayBioEntity/overlayBioEntity.selector.ts @@ -1,6 +1,7 @@ import { OverlayBioEntityRender } from '@/types/OLrendering'; import { createSelector } from '@reduxjs/toolkit'; import { allSubmapConnectionsBioEntitySelector } from '@/redux/bioEntity/bioEntity.selectors'; +import { mapModelIdSelector } from '@/redux/map/map.selectors'; import { currentSearchedBioEntityId } from '../drawer/drawer.selectors'; import { currentModelIdSelector } from '../models/models.selectors'; import { @@ -86,9 +87,18 @@ export const isOverlayActiveSelector = createSelector( ); export const isOverlayLoadingSelector = createSelector( - [overlayBioEntitySelector, (_, overlayId: number): number => overlayId], - ({ overlaysId, data }, overlayId) => - overlaysId.includes(overlayId) && data[overlayId] && !Object.keys(data[overlayId]).length, + [overlayBioEntitySelector, mapModelIdSelector, (_, overlayId: number): number => overlayId], + ({ overlaysId, data }, mapId, overlayId) => { + let result = false; + if (overlaysId.includes(overlayId)) { + if (data[overlayId] && !Object.keys(data[overlayId]).length) { + result = true; + } else if (data[overlayId] && !data[overlayId][mapId]) { + result = true; + } + } + return result; + }, ); export const activeOverlaysSelector = createSelector( -- GitLab