Skip to content

Commit

Permalink
IBX-6261: Fixed UDW Search module to set locations when unmounting (#861
Browse files Browse the repository at this point in the history
)
  • Loading branch information
barw4 authored Aug 24, 2023
1 parent c783449 commit 516741f
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';

import Tab from './components/tab/tab';
import Search from './components/search/search';

import { TabsConfigContext } from './universal.discovery.module';
import { LoadedLocationsMapContext, MarkedLocationIdContext, TabsConfigContext } from './universal.discovery.module';

const { ibexa, Translator } = window;

const SearchTabModule = () => {
const tabsConfig = useContext(TabsConfigContext);
const [markedLocationId, setMarkedLocationId] = useContext(MarkedLocationIdContext);
const [loadedLocationsMap, dispatchLoadedLocationsAction] = useContext(LoadedLocationsMapContext);

const actionsDisabledMap = {
'content-create-button': false,
'sort-switcher': true,
'view-switcher': true,
};

useEffect(() => {
return () => {
setMarkedLocationId(markedLocationId);
dispatchLoadedLocationsAction({ type: 'SET_LOCATIONS', data: loadedLocationsMap });
};
}, []);

return (
<div className="m-search-tab">
<Tab actionsDisabledMap={actionsDisabledMap}>
Expand Down

0 comments on commit 516741f

Please sign in to comment.