import { h, Component } from 'preact'; import { PropTypes } from 'preact-compat'; import debounce from 'lodash.debounce'; import { defaultState, loadNextPage, onSearchBoxType, performInitialSearch, search, toggleTag, } from '../searchableItemList/searchableItemList'; import { ItemListLoadMoreButton } from '../src/components/ItemList/ItemListLoadMoreButton'; import { ItemListTags } from '../src/components/ItemList/ItemListTags'; import { ItemListItem } from '../src/components/ItemList/ItemListItem'; export class History extends Component { constructor(props) { super(props); const { availableTags } = this.props; this.state = defaultState({ availableTags }); // bind and initialize all shared functions this.onSearchBoxType = debounce(onSearchBoxType.bind(this), 300, { leading: true, }); this.loadNextPage = loadNextPage.bind(this); this.performInitialSearch = performInitialSearch.bind(this); this.search = search.bind(this); this.toggleTag = toggleTag.bind(this); } componentDidMount() { const { hitsPerPage } = this.state; this.performInitialSearch({ containerId: 'history', indexName: 'UserHistory', searchOptions: { hitsPerPage, }, }); } renderEmptyItems() { const { selectedTags, query } = this.state; return (