Skip to content

Conversation

TheApeMachine
Copy link

Hi @chrisjpatty,

Submitting this for early review/guidance. I really wanted to use Flume, but I also really wanted to be able to make (HTTP) backend calls in the node resolvers, so I took a quick stab at making things async. I could not find any other way to make this work synchronously, the next node would always resolve before the request's response data was available.

This way it seems to work, but I have not tested it very rigurously. Planning to do this now as I integrate it further into our project at work.

My questions to you are these: am I going in the right direction? Is this a direction you are interested in for Flume, and would you be willing to share your thoughts about the idea of async Flume, or any other thing I should be mindful of?

Thank you for this package, I have always really liked it, and the edge and port UX and implementations are the best I have ever found.

Daniel Owen van Dommelen added 2 commits July 21, 2025 22:52
…ngine for improved async handling

- Changed peerDependencies for React and ReactDOM to allow versions >=16.8.0.
- Upgraded tslib to ^2.4.0 and typescript to ^4.8.4 in devDependencies.
- Refactored resolveInputValues and getValueOfConnection methods in RootEngine to be async, improving handling of asynchronous operations.
- Updated resolveRootNode to use async/await for better readability and error handling.
- Modified useRootEngine to utilize React state and effect hooks for resolving node values asynchronously.
@chrisjpatty
Copy link
Owner

Hey yes an async version of the engine would be great. It's been on my list of things to add. This looks roughly like the right direction, the only part that probably needs some rethinking is the useRootEngine hook which probably needs to use suspense of some kind to prevent runaway executions on every render.

Daniel Owen van Dommelen added 2 commits July 22, 2025 02:40
- Changed ContextMenu to use onClick with preventDefault instead of onMouseDown to enhance user interaction.
- Updated Stage component to stop event propagation on wheel events and adjusted the rendering of the ContextMenu within a Portal for better visibility control.
… handling

- Updated useRootEngine to utilize an AbortController for managing async operations and preventing state updates after unmounting.
- Enhanced error handling during root node resolution to log errors only if the operation is not aborted.
- Simplified the logic for setting resolved values based on the presence of nodes.
@TheApeMachine
Copy link
Author

I have tried to address the runaway executions issue, wondering what you think of the approach, using an abort controller. Just for reference, I am including a screenshot of my use-case, and how I am now (successfully) using this.

image

I realize now that without thinking I have also included a potential fix for the right click issue on Mac, but I can pull that out, as it is a bit of a different approach compared to the original code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants