Skip to content
Snippets Groups Projects
Commit 7be1c0a8 authored by mateusz-winiarczyk's avatar mateusz-winiarczyk
Browse files

fix(drawers): fix openning plugin and overlay drawers when ids are in url parameters

parent 44437279
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!172fix(drawers): fix openning plugin and overlay drawers when ids are in url parameters
import { PROJECT_ID } from '@/constants';
import { openSearchDrawerWithSelectedTab } from '@/redux/drawer/drawer.slice';
import { openOverlaysDrawer, openSearchDrawerWithSelectedTab } from '@/redux/drawer/drawer.slice';
import { AppDispatch } from '@/redux/store';
import { QueryData } from '@/types/query';
import { getDefaultSearchTab } from '@/components/FunctionalArea/TopBar/SearchBar/SearchBar.utils';
import { PluginsManager } from '@/services/pluginsManager';
import { createAsyncThunk } from '@reduxjs/toolkit';
import { ZERO } from '@/constants/common';
import { getAllBackgroundsByProjectId } from '../backgrounds/backgrounds.thunks';
import { getConfiguration, getConfigurationOptions } from '../configuration/configuration.thunks';
import {
......@@ -25,6 +26,7 @@ import { setPerfectMatch } from '../search/search.slice';
import { getSearchData } from '../search/search.thunks';
import { getStatisticsById } from '../statistics/statistics.thunks';
import { getSessionValid } from '../user/user.thunks';
import { openPluginsDrawer, setCurrentDrawerPluginHash } from '../plugins/plugins.slice';
interface InitializeAppParams {
queryData: QueryData;
......@@ -44,6 +46,13 @@ export const fetchInitialAppData = createAsyncThunk<
setHashedPlugin: PluginsManager.setHashedPlugin,
}),
);
const hash = queryData.pluginsId[ZERO];
if (hash) {
dispatch(openPluginsDrawer());
dispatch(setCurrentDrawerPluginHash(hash));
}
}
/** Fetch all data required for rendering map */
......@@ -90,5 +99,9 @@ export const fetchInitialAppData = createAsyncThunk<
/** fetch overlays */
if (queryData.overlaysId) {
dispatch(getInitOverlays({ overlaysId: queryData.overlaysId }));
if (!queryData.searchValue) {
dispatch(openOverlaysDrawer());
}
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment