From 11765d69f5f092a9bbd633dff462ec08651d26da Mon Sep 17 00:00:00 2001
From: Piotr Gawron <p.gawron@atcomp.pl>
Date: Wed, 14 Aug 2024 10:30:08 +0200
Subject: [PATCH] plugins must be loaded after the data is initialized

---
 src/redux/root/init.thunks.ts | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/redux/root/init.thunks.ts b/src/redux/root/init.thunks.ts
index 96d22326..18dabadf 100644
--- a/src/redux/root/init.thunks.ts
+++ b/src/redux/root/init.thunks.ts
@@ -40,6 +40,18 @@ export const fetchInitialAppData = createAsyncThunk<
 >('appInit/fetchInitialAppData', async ({ queryData }, { dispatch }): Promise<void> => {
   dispatch(setProjectId({ queryData }));
 
+  /** Fetch all data required for rendering map */
+
+  await Promise.all([
+    dispatch(getConstant()),
+    dispatch(getConfiguration()),
+    dispatch(getConfigurationOptions()),
+    dispatch(getProjectById(PROJECT_ID)),
+    dispatch(getAllBackgroundsByProjectId(PROJECT_ID)),
+    dispatch(getAllPublicOverlaysByProjectId(PROJECT_ID)),
+    dispatch(getModels()),
+  ]);
+
   if (queryData.pluginsId) {
     await dispatch(
       getInitPlugins({
@@ -56,17 +68,6 @@ export const fetchInitialAppData = createAsyncThunk<
     }
   }
 
-  /** Fetch all data required for rendering map */
-
-  await Promise.all([
-    dispatch(getConstant()),
-    dispatch(getConfiguration()),
-    dispatch(getConfigurationOptions()),
-    dispatch(getProjectById(PROJECT_ID)),
-    dispatch(getAllBackgroundsByProjectId(PROJECT_ID)),
-    dispatch(getAllPublicOverlaysByProjectId(PROJECT_ID)),
-    dispatch(getModels()),
-  ]);
   /**  Set map properties to allow rendering. If map params (modelId,backgroundId,position) are not provided in query -> it will be set to map default */
   await Promise.all([
     dispatch(initMapSizeAndModelId({ queryData })),
-- 
GitLab