Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 32903c3

Browse files
committed
make polly select responsive
1 parent 38f6a07 commit 32903c3

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

components/dataproducts/accessRequest/accessRequestForm.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { UserState } from '../../../lib/context'
1010
import ErrorMessage from '../../lib/error';
1111
import { PollyInput, SubjectType } from '../../../lib/rest/access';
1212
import { useSearchPolly } from '../../../lib/rest/polly';
13+
import { set } from 'lodash';
1314

1415
const tomorrow = () => {
1516
const date = new Date()
@@ -90,6 +91,7 @@ const AccessRequestFormV2 = ({
9091
const [searchText, setSearchText] = useState('')
9192
const [polly, setPolly] = useState<PollyInput | undefined | null>(null)
9293
const [submitted, setSubmitted] = useState(false)
94+
const [loadOptionsCallBack, setLoadOptionsCallBack] = useState<Function | null>(null)
9395
const router = useRouter()
9496
const userInfo = useContext(UserState)
9597

@@ -141,21 +143,22 @@ const AccessRequestFormV2 = ({
141143
label: string
142144
}
143145

146+
console.log(searchResult)
147+
loadOptionsCallBack?.(
148+
searchResult
149+
? searchResult.map((el) => {
150+
return { value: el.externalID, label: el.name }
151+
})
152+
: []
153+
)
154+
144155
const loadOptions = (
145156
input: string,
146157
callback: (options: Option[]) => void
147158
) => {
148159
console.log(input)
149160
setSearchText(input)
150-
setTimeout(() => {
151-
callback(
152-
searchResult
153-
? searchResult.map((el) => {
154-
return { value: el.externalID, label: el.name }
155-
})
156-
: []
157-
)
158-
}, 250)
161+
setLoadOptionsCallBack(() => callback)
159162
}
160163

161164
const onInputChange = (newOption: Option | null) => {

0 commit comments

Comments
 (0)