mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-11 00:10:40 +00:00
fix: address PR review feedback for upstream value composable (#9908)
## Summary follow up https://github.com/Comfy-Org/ComfyUI_frontend/pull/9851 fix https://github.com/Comfy-Org/ComfyUI_frontend/issues/9877 and https://github.com/Comfy-Org/ComfyUI_frontend/issues/9878 - Make useUpstreamValue generic to eliminate as Bounds/CurvePoint[] casts - Change isBoundsObject to type predicate (value is Bounds) - Reuse WidgetState from widgetValueStore instead of duplicate interface - Add length >= 2 guard in isCurvePointArray for empty arrays - Add disabled guard in effectiveBounds setter - Add unit tests for singleValueExtractor and boundsExtractor ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9908-fix-address-PR-review-feedback-for-upstream-value-composable-3236d73d365081f7a01dcb416732544a) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -39,7 +39,7 @@ const upstreamValue = useUpstreamValue(
|
||||
|
||||
const effectivePoints = computed(() =>
|
||||
isDisabled.value && upstreamValue.value
|
||||
? (upstreamValue.value as CurvePoint[])
|
||||
? upstreamValue.value
|
||||
: modelValue.value
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { CurvePoint } from './types'
|
||||
export function isCurvePointArray(value: unknown): value is CurvePoint[] {
|
||||
return (
|
||||
Array.isArray(value) &&
|
||||
value.length >= 2 &&
|
||||
value.every(
|
||||
(p) =>
|
||||
Array.isArray(p) &&
|
||||
|
||||
@@ -148,10 +148,10 @@ const upstreamValue = useUpstreamValue(
|
||||
const effectiveBounds = computed({
|
||||
get: () =>
|
||||
isDisabled.value && upstreamValue.value
|
||||
? (upstreamValue.value as Bounds)
|
||||
? upstreamValue.value
|
||||
: modelValue.value,
|
||||
set: (v) => {
|
||||
modelValue.value = v
|
||||
if (!isDisabled.value) modelValue.value = v
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user