fix: improve node internal updates in setNodeClass function (#4836)
* ✨ (use-handle-new-value.tsx): change the callback function to be asynchronous to introduce a delay of 500ms before updating node internals * 🐛 (use-handle-new-value.tsx): fix setNode function call to include additional parameters for immediate update and callback function to update node internals after setting the node class. * 🔧 (use-handle-new-value.tsx): Remove unnecessary line break to improve code readability and consistency * 🔧 (.github/workflows/typescript_test.yml): update matrix output to ensure proper JSON formatting using jq command
This commit is contained in:
parent
e2b947bcb2
commit
043cf14fba
2 changed files with 18 additions and 11 deletions
5
.github/workflows/typescript_test.yml
vendored
5
.github/workflows/typescript_test.yml
vendored
|
|
@ -12,7 +12,7 @@ on:
|
|||
description: "Test suites to run (JSON array)"
|
||||
required: false
|
||||
type: string
|
||||
default: '[]'
|
||||
default: "[]"
|
||||
release:
|
||||
description: "Whether this is a release build"
|
||||
required: false
|
||||
|
|
@ -153,7 +153,8 @@ jobs:
|
|||
|
||||
echo "Final test suites to run: $SUITES"
|
||||
echo "Test grep pattern: $TEST_GREP"
|
||||
echo "matrix=$SUITES" >> $GITHUB_OUTPUT
|
||||
# Ensure proper JSON formatting for matrix output
|
||||
echo "matrix=$(echo $SUITES | jq -c .)" >> $GITHUB_OUTPUT
|
||||
echo "test_grep=$TEST_GREP" >> $GITHUB_OUTPUT
|
||||
|
||||
setup-and-test:
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ const useHandleOnNewValue = ({
|
|||
const updateNodeInternals = useUpdateNodeInternals();
|
||||
|
||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||
|
||||
const postTemplateValue = usePostTemplateValue({
|
||||
parameterId: name,
|
||||
nodeId: nodeId,
|
||||
|
|
@ -72,14 +71,21 @@ const useHandleOnNewValue = ({
|
|||
|
||||
const setNodeClass = (newNodeClass: APIClassType) => {
|
||||
options?.setNodeClass && options.setNodeClass(newNodeClass);
|
||||
setNode(nodeId, (oldNode) => {
|
||||
const newData = cloneDeep(oldNode.data);
|
||||
newData.node = newNodeClass;
|
||||
return {
|
||||
...oldNode,
|
||||
data: newData,
|
||||
};
|
||||
});
|
||||
setNode(
|
||||
nodeId,
|
||||
(oldNode) => {
|
||||
const newData = cloneDeep(oldNode.data);
|
||||
newData.node = newNodeClass;
|
||||
return {
|
||||
...oldNode,
|
||||
data: newData,
|
||||
};
|
||||
},
|
||||
true,
|
||||
() => {
|
||||
updateNodeInternals(nodeId);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
if (shouldUpdate && changes.value !== undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue