mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 15:10:06 +00:00
Fixes linting configuration and type errors in apps/desktop-ui. ## Changes - Updated `eslint.config.ts` to use absolute path for `.oxlintrc.json` resolution. - Fixed `import-x` errors in `InstallFooter.vue`, `refUtil.ts`, and `DesktopDialogView.vue`. - Fixed i18n raw text error in `NotSupportedView.vue` via eslint-disable. - Fixed type inference issue in `i18n.ts` allowing dynamic locale switching. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7271-fix-desktop-ui-resolve-linting-and-typecheck-errors-2c46d73d3650817cbb66cc7b1dc670a8) by [Unito](https://www.unito.io)
31 lines
939 B
TypeScript
31 lines
939 B
TypeScript
import { useTimeout } from '@vueuse/core'
|
|
import { computed, ref, watch } from 'vue'
|
|
import type { Ref } from 'vue'
|
|
|
|
/**
|
|
* Vue boolean ref (writable computed) with one difference: when set to `true` it stays that way for at least {@link minDuration}.
|
|
* If set to `false` before {@link minDuration} has passed, it uses a timer to delay the change.
|
|
* @param value The default value to set on this ref
|
|
* @param minDuration The minimum time that this ref must be `true` for
|
|
* @returns A custom boolean vue ref with a minimum activation time
|
|
*/
|
|
export function useMinLoadingDurationRef(
|
|
value: Ref<boolean>,
|
|
minDuration = 250
|
|
) {
|
|
const current = ref(value.value)
|
|
|
|
const { ready, start } = useTimeout(minDuration, {
|
|
controls: true,
|
|
immediate: false
|
|
})
|
|
|
|
watch(value, (newValue) => {
|
|
if (newValue && !current.value) start()
|
|
|
|
current.value = newValue
|
|
})
|
|
|
|
return computed(() => current.value || !ready.value)
|
|
}
|