Skip to content

Commit

Permalink
No longer load on demand answer requests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Jan 16, 2023
1 parent 58ae95f commit 7b4d188
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions searchlib/components/AnswerBox/AnswerBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useAppConfig, useSearchContext } from '@eeacms/search/lib/hocs';
import { hasNonDefaultFilters } from '@eeacms/search/lib/search/helpers';

import Answers from './Answers';
import withAnswers from './withAnswers';
// import withAnswers from './withAnswers';
import useTimedMessage from './useTimedMessage';
import Loader from '../Loaders';

Expand Down Expand Up @@ -112,7 +112,7 @@ const AnswerBox = (props) => {
);
};

const WithLiveAnswers = withAnswers(AnswerBox);
// const WithLiveAnswers = withAnswers(AnswerBox);

const withStateAnswers = (WrappedComponent) => {
const WrappedAnswerBox = (props) => {
Expand All @@ -130,21 +130,31 @@ const withStateAnswers = (WrappedComponent) => {
} = appConfig?.nlp?.qa || {};

const isQuestion = qa_queryTypes.indexOf(query_type) > -1;

if (searchContext.answers) {
return (
<WrappedComponent
isQuestion={isQuestion}
data={searchContext.answers}
loading={false}
loaded={true}
searchedTerm={resultSearchTerm}
searchContext={searchContext}
/>
);
} else {
return <WithLiveAnswers {...props} />;
}
return (
<WrappedComponent
isQuestion={isQuestion}
data={searchContext.answers}
loading={false}
loaded={true}
searchedTerm={resultSearchTerm}
searchContext={searchContext}
/>
);

// if (searchContext.answers) {
// return (
// <WrappedComponent
// isQuestion={isQuestion}
// data={searchContext.answers}
// loading={false}
// loaded={true}
// searchedTerm={resultSearchTerm}
// searchContext={searchContext}
// />
// );
// } else {
// return <WithLiveAnswers {...props} />;
// }
};
return WrappedAnswerBox;
};
Expand Down

0 comments on commit 7b4d188

Please sign in to comment.