Skip to content

Commit

Permalink
Fix full view
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Mar 2, 2023
1 parent f9f4c91 commit a74c51a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion searchlib/components/SearchApp/FacetApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function FacetApp(props) {
() => () => {
removeFilter(field); // when the Facet is removed, we remove the filter
timerRef.current && clearTimeout(timerRef.current);
// console.log('unmount', field);
console.log('unmount', field);
},
[field, removeFilter],
);
Expand Down
22 changes: 21 additions & 1 deletion searchlib/components/SearchApp/SearchApp.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
import React from 'react';
import { SearchView } from '@eeacms/search/components/SearchView/SearchView';
import { getDefaultFilters } from '@eeacms/search/lib/utils';

import BasicSearchApp from './BasicSearchApp';

export default function SearchApp(props) {
return <BasicSearchApp {...props} searchViewComponent={SearchView} />;
const { defaultSort = '' } = props;
const [sortField, sortDirection] = defaultSort.split('|');
const appConfig = props.registry.searchui[props.appName];
const appDefaultFilters = getDefaultFilters(appConfig);
const [initialState] = React.useState({
...(appDefaultFilters?.length
? {
filters: appDefaultFilters,
}
: {}),
...(defaultSort ? { sortField, sortDirection } : {}),
}); // this makes the prop stable

return (
<BasicSearchApp
{...props}
initialState={initialState}
searchViewComponent={SearchView}
/>
);
}
5 changes: 3 additions & 2 deletions src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ function SearchBlockView(props) {
});

const key = `${location?.pathname || path}-${props.data?.appName}`;
// console.log('render searchblockview', key);
const Variation = variation.view;

// console.log('render searchblockview', key);
// React.useEffect(() => () => console.log('unmount SearchBlockView'), []);

return (
<div>
{mode !== 'view' && 'EEA Semantic Search block'}
{/* {JSON.stringify(data.defaultFilters)} */}
{mode !== 'view' && JSON.stringify(data.defaultFilters)}
<Variation
key={key}
slotFills={data.slotFills}
Expand Down

0 comments on commit a74c51a

Please sign in to comment.