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
Refactor InputLookupQA to use React hooks #1311
Conversation
3e02bfe
to
04e428b
Compare
04e428b
to
ec61387
Compare
import { bindActionCreators } from 'redux' | ||
import { connect } from 'react-redux' | ||
import { | ||
itemsForProperty, getDisplayValidations, getPropertyTemplate, findErrors, | ||
} from 'selectors/resourceSelectors' | ||
import { changeSelections } from 'actions/index' | ||
import search from 'actionCreators/qa' | ||
import { getSearchResults } from 'actionCreators/qa' |
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.
Why the switch from search to getSearchResults?
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.
Refactoring based on pairing with @justinlittman, using getSearchResults
from a new qa.js
module in utilities.
|
||
const search = (query) => { | ||
const currentAuthorities = [] | ||
const resultPromise = getSearchResults(query, props.propertyTemplate) |
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.
Ugh. I looked at getSearchResults -- we use a Promise.all(), which means we wait for the slowest search. Are we sure we want to do that?
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.
Not the greatest but I think speeding up/refactoring so that we are not using Promise.all
is a refactoring work. The QA search speed on the Sinopia side hasn't changed with this PR.
c63f8a6
to
01f7978
Compare
@jermnelson Is there a resource template that replicates the problem in local dev? |
Yes, in the |
01f7978
to
56a45a2
Compare
Steps to reproduce (running locally):
|
Hi @justinlittman, good catch. I just added some error checking if QA returns an error. The Add Name uses |
219bf03
to
0d7e6f2
Compare
0d7e6f2
to
516f3fe
Compare
516f3fe
to
538ffe5
Compare
…d to refactor Menu function
better reflect that we are no longer using an actionCreator in the InputLookupQA component
538ffe5
to
f1b0197
Compare
This PR fixes open issue #1273, refactored
InputLookupQA
to use React hooks for retrieving options similar to theInputLookupSinopia
pattern.Remaining work before this draft PR is finished:
eslint errors and warningssubtype=context