Commit c20730b0 authored by Aron Fiechter's avatar Aron Fiechter
Browse files

Show initial query in query input field

parent dbd37c47
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { performQuery, selectError } from './querySlice'; import { performQuery, selectError, selectQuery } from './querySlice';
import { openModal } from '../search/searchSlice'; import { openModal } from '../search/searchSlice';
import Form from 'react-bootstrap/Form'; import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button'; import Button from 'react-bootstrap/Button';
export default function Query(props) { export default function Query(props) {
// The component state is just the query text (for now) // 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 // Dispatch and selectors used in this component
const dispatch = useDispatch(); const dispatch = useDispatch();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment