fix: glitch download from onboarding (#5269)

This commit is contained in:
Faisal Amir 2025-06-14 17:38:14 +07:00 committed by GitHub
parent 1e17cc6ec7
commit b5bdf3cfd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,6 +78,7 @@ function Hub() {
null
)
const downloadButtonRef = useRef<HTMLButtonElement>(null)
const hasTriggeredDownload = useRef(false)
const { getProviderByName } = useModelProvider()
const llamaProvider = getProviderByName('llama.cpp')
@ -285,12 +286,18 @@ function Hub() {
const handleJoyrideCallback = (data: CallBackProps) => {
const { status, index } = data
if (status === STATUS.FINISHED && !isDownloading && isLastStep) {
if (
status === STATUS.FINISHED &&
!isDownloading &&
isLastStep &&
!hasTriggeredDownload.current
) {
const recommendedModel = filteredModels.find((model) =>
isRecommendedModel(model.metadata?.id)
)
if (recommendedModel && recommendedModel.models[0]?.id) {
if (downloadButtonRef.current) {
hasTriggeredDownload.current = true
downloadButtonRef.current.click()
}
return