-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(editor): Migrate FixedCollectionParameter to composition API #11555
base: master
Are you sure you want to change the base?
refactor(editor): Migrate FixedCollectionParameter to composition API #11555
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
this.mutableValues = deepCopy(this.values); | ||
const locale = useI18n(); | ||
|
||
const props = defineProps<{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use withDefaults
here to set the same default values as before. Just to be sure the component behaves exactly the same as before.
parameter: INodeProperties; | ||
path: string; | ||
values: Record<string, INodeParameters[]>; | ||
isReadOnly: boolean | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values and isReadOnly should be optional (they don't have required=true in defineComponent)
return !!props.parameter.typeOptions?.multipleValues; | ||
}); | ||
const parameterOptions = computed(() => { | ||
if (multipleValues && isINodePropertyCollectionList(props.parameter.options)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multipleValues.value
}>(); | ||
|
||
const emit = defineEmits<{ | ||
valueChanged: [value?: any]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify a type for value
. From usage I think it should be something like
type ValueChangedEvent = { path: string; value: NodeParameterValueType; type?: 'optionsOrderChanged'; }
} else { | ||
newValue = newParameterValue; | ||
} | ||
let newValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible set a type for newValue, maybe NodeParameterValueType
newValue = newParameterValue; | ||
} | ||
let newValue; | ||
if (multipleValues) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multipleValues.value
return props.parameter.options; | ||
} | ||
|
||
return (props.parameter.options as INodePropertyCollection[]).filter((option) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this type cast is avoidable by doing props.parameter.options ?? []
, would be safer too 😄
Summary
This PR migrates FixedCollectionParameter to composition API
Related Linear tickets, Github issues, and Community forum posts
Review / Merge checklist
release/backport
(if the PR is an urgent fix that needs to be backported)