Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
e60e8058
Commit
e60e8058
authored
Jan 05, 2024
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow clearing filter query via `store.setFilterQuery(null)`
parent
5e632d59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
filters.ts
src/sidebar/store/modules/filters.ts
+4
-3
filters-test.js
src/sidebar/store/modules/test/filters-test.js
+6
-4
No files found.
src/sidebar/store/modules/filters.ts
View file @
e60e8058
...
...
@@ -149,7 +149,7 @@ const reducers = {
return
{
filters
:
updatedFilters
};
},
SET_FILTER_QUERY
(
state
:
State
,
action
:
{
query
:
string
})
{
SET_FILTER_QUERY
(
state
:
State
,
action
:
{
query
:
string
|
null
})
{
return
{
query
:
action
.
query
};
},
...
...
@@ -217,9 +217,10 @@ function setFilter(filterName: FilterKey, filterOption: FilterOption) {
}
/**
* Set the query used to filter displayed annotations.
* Set the query used to filter displayed annotations or `null` to clear the
* filter.
*/
function
setFilterQuery
(
query
:
string
)
{
function
setFilterQuery
(
query
:
string
|
null
)
{
return
makeAction
(
reducers
,
'SET_FILTER_QUERY'
,
{
query
});
}
...
...
src/sidebar/store/modules/test/filters-test.js
View file @
e60e8058
...
...
@@ -138,10 +138,12 @@ describe('sidebar/store/modules/filters', () => {
});
describe
(
'setFilterQuery'
,
()
=>
{
it
(
'sets the filter query'
,
()
=>
{
store
.
setFilterQuery
(
'a-query'
);
assert
.
equal
(
getFiltersState
().
query
,
'a-query'
);
assert
.
equal
(
store
.
filterQuery
(),
'a-query'
);
[
'a-query'
,
''
,
null
].
forEach
(
query
=>
{
it
(
'sets the filter query'
,
()
=>
{
store
.
setFilterQuery
(
query
);
assert
.
equal
(
getFiltersState
().
query
,
query
);
assert
.
equal
(
store
.
filterQuery
(),
query
);
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment