Merge pull request #3393 from janhq/fix/fe-emits-ugly-errors-on-extensions-load
fix: app emits ugly errors when retrieving settings
This commit is contained in:
commit
701d78cebd
@ -168,6 +168,7 @@ export abstract class BaseExtension implements ExtensionType {
|
|||||||
])
|
])
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (!(await fs.existsSync(settingPath))) return []
|
||||||
const content = await fs.readFileSync(settingPath, 'utf-8')
|
const content = await fs.readFileSync(settingPath, 'utf-8')
|
||||||
const settings: SettingComponentProps[] = JSON.parse(content)
|
const settings: SettingComponentProps[] = JSON.parse(content)
|
||||||
return settings
|
return settings
|
||||||
|
|||||||
@ -15,7 +15,6 @@ const ListContainer = ({ children }: Props) => {
|
|||||||
const currentScrollTop = event.currentTarget.scrollTop
|
const currentScrollTop = event.currentTarget.scrollTop
|
||||||
|
|
||||||
if (prevScrollTop.current > currentScrollTop) {
|
if (prevScrollTop.current > currentScrollTop) {
|
||||||
console.debug('User is manually scrolling up')
|
|
||||||
isUserManuallyScrollingUp.current = true
|
isUserManuallyScrollingUp.current = true
|
||||||
} else {
|
} else {
|
||||||
const currentScrollTop = event.currentTarget.scrollTop
|
const currentScrollTop = event.currentTarget.scrollTop
|
||||||
@ -23,7 +22,6 @@ const ListContainer = ({ children }: Props) => {
|
|||||||
const clientHeight = event.currentTarget.clientHeight
|
const clientHeight = event.currentTarget.clientHeight
|
||||||
|
|
||||||
if (currentScrollTop + clientHeight >= scrollHeight) {
|
if (currentScrollTop + clientHeight >= scrollHeight) {
|
||||||
console.debug('Scrolled to the bottom')
|
|
||||||
isUserManuallyScrollingUp.current = false
|
isUserManuallyScrollingUp.current = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,9 +72,6 @@ export default function useRecommendedModel() {
|
|||||||
// if we don't have [lastUsedModelId], then we can just use the first model
|
// if we don't have [lastUsedModelId], then we can just use the first model
|
||||||
// in the downloaded list
|
// in the downloaded list
|
||||||
if (!lastUsedModelId) {
|
if (!lastUsedModelId) {
|
||||||
console.debug(
|
|
||||||
`No last used model, using first model in list ${models[0].id}}`
|
|
||||||
)
|
|
||||||
setRecommendedModel(models[0])
|
setRecommendedModel(models[0])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -90,7 +87,6 @@ export default function useRecommendedModel() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug(`Using last used model ${lastUsedModel.id}`)
|
|
||||||
setRecommendedModel(lastUsedModel)
|
setRecommendedModel(lastUsedModel)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [getAndSortDownloadedModels, activeThread])
|
}, [getAndSortDownloadedModels, activeThread])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user