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)"
|
description: "Test suites to run (JSON array)"
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: '[]'
|
default: "[]"
|
||||||
release:
|
release:
|
||||||
description: "Whether this is a release build"
|
description: "Whether this is a release build"
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -153,7 +153,8 @@ jobs:
|
||||||
|
|
||||||
echo "Final test suites to run: $SUITES"
|
echo "Final test suites to run: $SUITES"
|
||||||
echo "Test grep pattern: $TEST_GREP"
|
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
|
echo "test_grep=$TEST_GREP" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
setup-and-test:
|
setup-and-test:
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ const useHandleOnNewValue = ({
|
||||||
const updateNodeInternals = useUpdateNodeInternals();
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
|
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
|
|
||||||
const postTemplateValue = usePostTemplateValue({
|
const postTemplateValue = usePostTemplateValue({
|
||||||
parameterId: name,
|
parameterId: name,
|
||||||
nodeId: nodeId,
|
nodeId: nodeId,
|
||||||
|
|
@ -72,14 +71,21 @@ const useHandleOnNewValue = ({
|
||||||
|
|
||||||
const setNodeClass = (newNodeClass: APIClassType) => {
|
const setNodeClass = (newNodeClass: APIClassType) => {
|
||||||
options?.setNodeClass && options.setNodeClass(newNodeClass);
|
options?.setNodeClass && options.setNodeClass(newNodeClass);
|
||||||
setNode(nodeId, (oldNode) => {
|
setNode(
|
||||||
|
nodeId,
|
||||||
|
(oldNode) => {
|
||||||
const newData = cloneDeep(oldNode.data);
|
const newData = cloneDeep(oldNode.data);
|
||||||
newData.node = newNodeClass;
|
newData.node = newNodeClass;
|
||||||
return {
|
return {
|
||||||
...oldNode,
|
...oldNode,
|
||||||
data: newData,
|
data: newData,
|
||||||
};
|
};
|
||||||
});
|
},
|
||||||
|
true,
|
||||||
|
() => {
|
||||||
|
updateNodeInternals(nodeId);
|
||||||
|
},
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (shouldUpdate && changes.value !== undefined) {
|
if (shouldUpdate && changes.value !== undefined) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue