import { connect } from "react-redux";
import EntriesPage from "../components/EntriesPage.js";
import { clearSearchResults } from "../library/messaging.js";
import { searchEntriesForTerm } from "../../shared/library/messaging.js";

export default connect(
    (state, ownProps) => ({}),
    {
        onPrepare: () => () => {
            clearSearchResults();
        },
        onSearchTermChange: searchTerm => () => {
            if (searchTerm.trim().length > 0) {
                searchEntriesForTerm(searchTerm);
            } else {
                clearSearchResults();
            }
        }
    }
)(EntriesPage);

import { connect } from "react-redux";
import EntriesPage from "../components/EntriesPage.js";
import { clearSearchResults } from "../library/messaging.js";
import { searchEntriesForTerm } from "../../shared/library/messaging.js";

export default connect(
    (state, ownProps) => ({}),
    {
        onPrepare: () => () => {},
        onSearchTermChange: searchTerm => () => {
            if (searchTerm.trim().length > 0) {
                searchEntriesForTerm(searchTerm);
            } else {
                clearSearchResults();
            }
        }
    }
)(EntriesPage);

Stop clearing search results on popup init