Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
public
Mímir
Commits
c20730b0
Commit
c20730b0
authored
Aug 13, 2020
by
Aron Fiechter
Browse files
Show initial query in query input field
parent
dbd37c47
Changes
1
Show whitespace changes
Inline
Side-by-side
client/src/components/navbar/Query.js
View file @
c20730b0
import
React
,
{
useState
}
from
'
react
'
;
import
{
useDispatch
,
useSelector
}
from
'
react-redux
'
;
import
{
performQuery
,
selectError
}
from
'
./querySlice
'
;
import
{
performQuery
,
selectError
,
selectQuery
}
from
'
./querySlice
'
;
import
{
openModal
}
from
'
../search/searchSlice
'
;
import
Form
from
'
react-bootstrap/Form
'
;
import
Button
from
'
react-bootstrap/Button
'
;
export
default
function
Query
(
props
)
{
// The component state is just the query text (for now)
const
[
text
,
setText
]
=
useState
(
''
);
const
previousQuery
=
useSelector
(
selectQuery
);
const
[
text
,
setText
]
=
useState
(
previousQuery
?.
fields
?.
find
((
f
)
=>
f
.
key
===
'
allData
'
)?.
value
||
''
,
);
// Dispatch and selectors used in this component
const
dispatch
=
useDispatch
();
...
...
Write
Preview
Supports
Markdown
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