Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
2ffb5f03
Commit
2ffb5f03
authored
6 years ago
by
Esko Ikkala
Browse files
Options
Downloads
Patches
Plain Diff
Clear suggestions when results update
parent
dfc0d036
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/IntegrationAutosuggest.js
+5
-1
5 additions, 1 deletion
src/components/IntegrationAutosuggest.js
src/epics/index.js
+1
-0
1 addition, 0 deletions
src/epics/index.js
src/reducers/search.js
+6
-1
6 additions, 1 deletion
src/reducers/search.js
with
12 additions
and
2 deletions
src/components/IntegrationAutosuggest.js
+
5
−
1
View file @
2ffb5f03
...
...
@@ -75,10 +75,14 @@ const IntegrationAutosuggest = (props) => {
const
handleOnChange
=
(
event
,
{
newValue
})
=>
props
.
updateQuery
(
newValue
);
const
handleOnSuggestionSelected
=
()
=>
props
.
fetchResults
();
const
handleOnSuggestionSelected
=
()
=>
{
props
.
clearSuggestions
();
props
.
fetchResults
();
};
const
handleOnKeyDown
=
(
event
)
=>
{
if
(
event
.
key
===
'
Enter
'
)
{
props
.
clearSuggestions
();
props
.
fetchResults
();
}
};
...
...
This diff is collapsed.
Click to expand it.
src/epics/index.js
+
1
−
0
View file @
2ffb5f03
...
...
@@ -35,6 +35,7 @@ const getSuggestionsEpic = (action$, store) => {
const
getResultsEpic
=
(
action$
,
store
)
=>
{
const
searchUrl
=
'
http://localhost:3000/search
'
;
return
action$
.
ofType
(
FETCH_RESULTS
)
.
debounceTime
(
500
)
.
switchMap
(()
=>
{
const
{
query
,
datasets
}
=
store
.
getState
().
search
;
if
(
query
.
length
<
3
)
{
...
...
This diff is collapsed.
Click to expand it.
src/reducers/search.js
+
6
−
1
View file @
2ffb5f03
...
...
@@ -27,7 +27,12 @@ const search = (state = INITIAL_STATE, action) => {
return
{
...
state
,
suggestions
:
suggestions
(
state
.
suggestions
,
action
)
};
case
CLEAR_RESULTS
:
case
UPDATE_RESULTS
:
return
{
...
state
,
results
:
results
(
state
.
results
,
action
)
};
return
{
...
state
,
suggestions
:
[],
results
:
results
(
state
.
results
,
action
)
};
default
:
return
state
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment