-
Notifications
You must be signed in to change notification settings - Fork 23
Description
What behavior were you expecting?
When I open ImageManager from new articles page, I expect all filters to start fresh without anything being pre-selected
What actually happened?
Tag filter is initially rendered with onRemove option enabled (aka have X withint the button).
Steps to reproduce
- Go to /articles/new
- Click on Add feature Image
- Check filters
What was your environment like?
Google Chrome 74.0.3729.131 on Ubuntu 16.04
Getting started
This component rendered in this line inside ImageManager/index.js.
If you go down the components <TagsFilterInput> renders <ItemSelectinput> which calls getSelected() as defined here which determines what is returned vased on value prop.
When getSelected() is called for TagsFilterInput, the method is returning [[]]. The array of empty array's length is checked here. The goal would be for getSelected() to return [] correctly in the initial render of <TagsFilterInput>
ImageManager currently have this initial state as defined here:
this.state = {
author: '',
tags: [], // Empty array
q: '',
limit: DEFAULT_QUERY.limit,
}On initial render this.state.tags is passed as value prop of <TagsFilterInput> that is causing this bug.
This issue can be fixed if we update the initial state to be
this.state = {
author: '',
tags: '', // Empty string
q: '',
limit: DEFAULT_QUERY.limit,
}