-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React UI: Filters history #1225
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ const defaultState: AnnotationState = { | |
collapsed: {}, | ||
states: [], | ||
filters: [], | ||
filtersHistory: [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In old UI we use local storage to save filters between sessions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bsekachev, maybe it can be useful to have one storage for user data like settings, history etc, can it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think about settings storage now. It was not a feature before and we should not hasten about it. Need to discuss it IRL before implementation |
||
history: { | ||
undo: [], | ||
redo: [], | ||
|
@@ -947,10 +948,19 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { | |
} | ||
case AnnotationActionTypes.CHANGE_ANNOTATIONS_FILTERS: { | ||
const { filters } = action.payload; | ||
const { filtersHistory, filters: oldFilters } = state.annotations; | ||
bsekachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
filters.forEach((element: string) => { | ||
if (!(filtersHistory.includes(element) || oldFilters.includes(element))) { | ||
filtersHistory.push(element); | ||
} | ||
}); | ||
|
||
return { | ||
...state, | ||
annotations: { | ||
...state.annotations, | ||
filtersHistory: filtersHistory.slice(-10), | ||
filters, | ||
}, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add comment here.
Something like:
it is guaranteed, that each filter is unique
because keys must be unique