Skip to content

Commit

Permalink
give up, use <a> instead of <Link>
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Mar 6, 2023
1 parent 2a88bf2 commit 7a04dbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
6 changes: 3 additions & 3 deletions searchlib/components/SearchView/BackToHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export default function BackToHome({

return backToHome ? (
backToHome.startsWith('/') ? (
<Link
to={backToHome}
<a
href={backToHome}
className="back-link"
onClick={() => {
if (isLocal) {
Expand All @@ -45,7 +45,7 @@ export default function BackToHome({
>
<Icon className="arrow left" />
Back to search home
</Link>
</a>
) : (
<a
href={backToHome}
Expand Down
26 changes: 1 addition & 25 deletions searchlib/components/SearchView/SearchView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { isLandingPageAtom } from './state';
const useWasInteracted = ({ searchedTerm, searchContext, appConfig }) => {
// a check that, once toggled true, it always return true

const [cached, setCached] = React.useState();
const [cached, setCached] = React.useState(null);

const wasInteracted = !!(
searchedTerm ||
Expand All @@ -39,29 +39,12 @@ const useWasInteracted = ({ searchedTerm, searchContext, appConfig }) => {
if (wasInteracted && !cached) {
setCached(true);
}
// else if (!wasInteracted && cached === true) {
// setCached(false);
// }
}, [wasInteracted, cached]);

const resetInteracted = React.useCallback(() => {
console.log('reset');
setCached(false);
}, []);

// console.log('wasInteracted', {
// wasInteracted,
// searchedTerm,
//
// check: checkInteracted({
// searchContext,
// appConfig,
// }),
// cached,
// });

React.useEffect(() => () => console.log('unmount'), []);

return {
wasInteracted: cached || wasInteracted,
resetInteracted,
Expand All @@ -70,7 +53,6 @@ const useWasInteracted = ({ searchedTerm, searchContext, appConfig }) => {

export const SearchView = (props) => {
const { appConfig, appName, mode = 'view' } = props;
// React.useEffect(() => () => console.log('unmount searchview'), []);

const searchContext = useSearchContext();
const { driver } = React.useContext(SUISearchContext);
Expand All @@ -88,12 +70,6 @@ export const SearchView = (props) => {
appConfig,
});

// console.log(
// 'searchedTerm',
// `-[${searchedTerm}]-[${searchContext.searchTerm}]-`,
// wasInteracted,
// );

React.useEffect(() => {
window.searchContext = searchContext;
}, [searchContext]);
Expand Down

0 comments on commit 7a04dbd

Please sign in to comment.