Skip to content

Commit

Permalink
Solved problem
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Dec 15, 2022
1 parent 94ce82d commit fbc914d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 27 deletions.
4 changes: 4 additions & 0 deletions razzle.extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const modify = (config, { target, dev }, webpack) => {
config.resolve.alias['@eeacms/search'] = searchlibPath;
include.push(searchlibPath);

if (config.devServer) {
config.devServer.watchOptions.ignored = /node_modules\/(?!(@plone\/volto|@elastic))/g;
}

return config;
};

Expand Down
3 changes: 2 additions & 1 deletion searchlib/components/FilterList/ActiveFilterValue.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useAppConfig } from '@eeacms/search/lib/hocs';
import { Term } from '@eeacms/search/components';
import { Label, Card, Button, Icon } from 'semantic-ui-react';
import { Label } from 'semantic-ui-react';

const ActiveFilterValue = (props) => {
const { field, values, removeFilter } = props;
Expand All @@ -21,6 +21,7 @@ const ActiveFilterValue = (props) => {
{values?.map((value, index) => {
return (
<Label
key={index}
className="filter-value"
basic
removeIcon="close"
Expand Down
14 changes: 1 addition & 13 deletions searchlib/components/SearchApp/BasicSearchApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import React from 'react';
import { SearchProvider, withSearch } from '@elastic/react-search-ui'; // ErrorBoundary, WithSearch,

import { AppConfigContext, SearchContext } from '@eeacms/search/lib/hocs';
import {
onResultClick,
onAutocompleteResultClick,
bindOnAutocomplete,
bindOnSearch,
} from '@eeacms/search/lib/request';
import { bindOnAutocomplete, bindOnSearch } from '@eeacms/search/lib/request';
import useSearchApp from './useSearchApp';

function SearchWrappers(SearchViewComponent) {
Expand Down Expand Up @@ -70,13 +65,6 @@ export default function BasicSearchApp(props) {
return withSearch(mapContextToProps)(SearchWrappers(searchViewComponent));
}, [mapContextToProps, searchViewComponent]);

React.useEffect(() => {
console.log('mount basicsearchapp');
return () => console.log('unmount basicsearchapp');
}, []);

// console.log('redraw basicsearchapp', isLoading);

return driverInstance ? (
<SearchProvider config={elasticConfig} driver={driverInstance}>
<WrappedSearchView
Expand Down
8 changes: 4 additions & 4 deletions searchlib/components/SearchApp/SearchApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { SearchView } from '@eeacms/search/components/SearchView/SearchView';
import BasicSearchApp from './BasicSearchApp';

export default function SearchApp(props) {
React.useEffect(() => {
console.log('mount searchapp');
return () => console.log('unmount searchapp');
}, []);
// React.useEffect(() => {
// console.log('mount searchapp');
// return () => console.log('unmount searchapp');
// }, []);
return <BasicSearchApp {...props} searchViewComponent={SearchView} />;
}
13 changes: 8 additions & 5 deletions searchlib/components/SearchApp/useSearchApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ function useSearchApp({
const onSearch = React.useCallback(
async (state) => {
setIsLoading(true);
console.log('searching', state);
// console.log('searching', state);
const res = await paramOnSearch(appConfig)(state);
console.log('search done', res);
// console.log('search done', res);
setIsLoading(false);
return res;
},
Expand Down Expand Up @@ -73,16 +73,19 @@ function useSearchApp({
? { filters: getDefaultFilters(appConfig) }
: {}),
},
// debug: true,
// trackUrlState: false,
debug: true,
}),
[appConfig, onAutocomplete, onSearch, locationSearchTerm],
);

const { facetOptions } = React.useState(useFacetsWithAllOptions(appConfig));

const [driverInstance] = React.useState(
__CLIENT__ ? new SearchDriver(elasticConfig) : null,
const driver = React.useMemo(
() => (__CLIENT__ ? new SearchDriver(elasticConfig) : null),
[elasticConfig],
);
const [driverInstance] = React.useState(driver);

const mapContextToProps = React.useCallback(
(params) => {
Expand Down
8 changes: 4 additions & 4 deletions searchlib/components/SearchView/SearchView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export const SearchView = (props) => {

const customClassName = !wasInteracted ? 'landing-page' : 'simple-page';

React.useEffect(() => {
console.log('mount searchview');
return () => console.log('unmount searchview');
}, []);
// React.useEffect(() => {
// console.log('mount searchview');
// return () => console.log('unmount searchview');
// }, []);

return (
<div className={`searchapp searchapp-${appName} ${customClassName}`}>
Expand Down

0 comments on commit fbc914d

Please sign in to comment.