mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-19 07:57:00 +00:00
Fix search form re-rendering spuriously in web UI (#28876)
This commit is contained in:
parent
61a0ec69fc
commit
01ce9df880
|
@ -1,3 +1,4 @@
|
||||||
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -12,10 +13,15 @@ import {
|
||||||
|
|
||||||
import Search from '../components/search';
|
import Search from '../components/search';
|
||||||
|
|
||||||
|
const getRecentSearches = createSelector(
|
||||||
|
state => state.getIn(['search', 'recent']),
|
||||||
|
recent => recent.reverse(),
|
||||||
|
);
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
value: state.getIn(['search', 'value']),
|
value: state.getIn(['search', 'value']),
|
||||||
submitted: state.getIn(['search', 'submitted']),
|
submitted: state.getIn(['search', 'submitted']),
|
||||||
recent: state.getIn(['search', 'recent']).reverse(),
|
recent: getRecentSearches(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
Loading…
Reference in a new issue