Skip to content
Open
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
20 changes: 13 additions & 7 deletions packages/redux-devtools-inspector/src/ActionList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,19 @@ export default class ActionList extends Component {
onJumpToState
} = this.props;
const lowerSearchValue = searchValue && searchValue.toLowerCase();
const filteredActionIds = searchValue
? actionIds.filter(
id =>
actions[id].action.type.toLowerCase().indexOf(lowerSearchValue) !==
-1
)
: actionIds;

const shouldMatchNegative = lowerSearchValue && lowerSearchValue.indexOf('!') === 0;
const query = shouldMatchNegative ? lowerSearchValue.substring(1) : lowerSearchValue;

const filterFunction = id => {
const actionIndex = actions[id].action.type.toLowerCase().indexOf(query);
if (shouldMatchNegative) {
return actionIndex === -1;
}
return actionIndex !== -1;
};

const filteredActionIds = searchValue ? actionIds.filter(filterFunction) : actionIds;

return (
<div
Expand Down