Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/SortFilter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('Instantiate SortFilter component via mount', () => {
expect(wrapper.find(Core).instance().element.current).toMatchSnapshot();
})

function Elements({ itemSelector }) {
function Elements({ itemSelector, records }) {
return records.map((record) => <Element key={record.id} record={record} itemSelector={itemSelector} />);
}

Expand Down
29 changes: 2 additions & 27 deletions src/SortFilter/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,12 @@ class Core extends Component {
super(props);
this.state = {
// taxonomies: {},
taxonomiesBodyTypeNames: []
taxonomiesBodyTypeNames: Object.keys(this.props.taxonomies['Body Types'])
};
this.element = React.createRef();
this.sizer = React.createRef();
}

UNSAFE_componentWillMount() {
/**
* Kick off the network request and update the state once it returns.
*/
const { taxonomies } = this.props;
this._loadProps()
.then(() => {
this.setState({
// taxonomies,
taxonomiesBodyTypeNames: Object.keys(taxonomies['Body Types'])
});
});
}

componentDidMount() {
// let options = {
// // reverse: true,
Expand All @@ -49,6 +35,7 @@ class Core extends Component {
sizer: this.sizer.current,
// initialSort: options
});
putSearchParams(this.props.defaultSort);
this.sortFromUrlSearch();
}

Expand Down Expand Up @@ -144,18 +131,6 @@ class Core extends Component {
this.slider.classList.toggle('slider-closed');
}

/**
* Set delay
* @return {Promise<Object[]>} A promise which resolves with an array of objects.
*/
_loadProps() {
return new Promise((resolve) => {
setTimeout(() => {
resolve(this.props);
}, 500);
});
}

render() {
const { taxonomiesBodyTypeNames } = this.state;
const { children, itemSelector } = this.props;
Expand Down