Skip to content

Commit

Permalink
fix(Progress): indeterminate state is wrong when value is 0 (#911)
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed May 13, 2024
1 parent a615de2 commit 3f5e507
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/radix-vue/src/Progress/ProgressRoot.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { ComputedRef, Ref } from 'vue'
import type { PrimitiveProps } from '@/Primitive'
import { createContext, useForwardExpose } from '@/shared'
import { createContext, isNullish, useForwardExpose } from '@/shared'
export type ProgressRootEmits = {
/** Event handler called when the progress value changes */
Expand Down Expand Up @@ -113,7 +113,7 @@ watch(
// ------- End of watch for correct values -------
const progressState = computed<ProgressState>(() => {
if (!modelValue.value)
if (isNullish(modelValue.value))
return 'indeterminate'
if (modelValue.value === max.value)
return 'complete'
Expand Down
3 changes: 2 additions & 1 deletion packages/radix-vue/src/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export { createContext } from './createContext'
export { handleAndDispatchCustomEvent } from './handleAndDispatchCustomEvent'
export { isValidVNodeElement } from './isValidVNodeElement'
export * from './browser'
export * from './arrays'
export * from './browser'
export * from './object'
export * from './nullish'
export { type DateRange } from './date'
export { onFocusOutside } from './onFocusOutside'
export { renderSlotFragments } from './renderSlotFragments'
Expand Down
3 changes: 3 additions & 0 deletions packages/radix-vue/src/shared/nullish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isNullish(value: any): boolean {
return value === null || value === undefined
}

0 comments on commit 3f5e507

Please sign in to comment.