Fixed Execution number node not working when collapsed #2766
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Execution Number node didn't work when collapsed because its value was set using a
useEffect
in its input element. Since that input element wasn't rendered when collapsed, the side effect didn't happen, and so the execution number didn't update.The same bug of input/output side effects not working could so be observed for other nodes. E.g. Load Image would stop updating the output type of the image when collapsed.
This PR fixes this by always rendering input and output element, which ensures that their side effects happen. Since we don't actually want to show them, elements are rendered into a box with
display: none
andcontain: strict
. This ensures that the browser can basically ignore the rendered input/output elements, so there won't be a perf impact.Lastly, I had to disable handles for the collapsed input/output elements. ReactFlow also uses side effects for its handles, but we don't want those side effects.