Flow Render: Render Vue components in async flows — make your UI awaitable #14563
Replies: 2 comments
-
|
Hey @shixianqin, Working with Vue reactivity system and compilers can sometimes present interesting edge cases. A few quick things to consider regarding this topic:
I highly recommend checking out the Vue DevTools extension to inspect the component tree and verify if the state is updating as expected. Let me know if you want to dig deeper into the specific component logic. Hope this points you in the right direction! Let me know how it goes. Happy coding! |
Beta Was this translation helpful? Give feedback.
-
|
@shixianqin That’s a very interesting approach — thanks for sharing Flow Render. What stands out is how it flips the usual state‑driven pattern into a Promise‑based flow. Instead of juggling flags and watchers, you can literally A few highlights I see from your examples:
For teams already using Vue/Nuxt, this could simplify a lot of boilerplate around modals and step‑based flows. Instead of managing global state or event buses, you just I’d be curious to see how this integrates with Nuxt’s server routes or Vuex/Pinia stores — for example, intercepting a login flow or permission check before dispatching an action. But even as‑is, it looks like a clean abstraction for interactive UI logic. Nice work — this feels like it could become a standard pattern for handling dialogs and workflows in Vue projects. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Flow Render provides a Promise-based UI rendering approach that allows you to render components like calling
asynchronous functions and wait for user interaction results.
Installation
Quick Start
Mount the Viewport
Place a
<Viewport/>at the root of your application. All dynamically rendered components will appear here.Define Components
Flow Render supports two ways to write components; you can choose based on your scenario.
Executor Mode (Recommended)
Components directly declare and use
resolve/rejectcallbacks, similar to thenew Promise((resolve, reject) => ...)executor style.
Callbacks are automatically injected when rendering:
Adapter Mode (Flexible and Powerful)
Adapter mode allows you to dynamically associate props of any component with a Promise. You simply provide a function
that receives
resolveandrejectand returns the component's props. This approach not only works with existingcomponents but also enables more complex logic, such as determining props based on external data, conditional rendering,
dynamic bindings, etc.
When rendering with adapter mode, you establish the connection between the Promise and component callbacks via an
adapter function:
childrenpropVue has a special
childrenprop that is automatically mapped to the slots.When your component needs to receive children, exclude the
childrenprop from Props, use<slot/>in thetemplate.
Pass children when rendering:
Use Cases
Flow Render is particularly suitable for the following interactions:
For example, you can write previously scattered interactions as a linear flow:
Compared to traditional state-driven approaches, this method is easier to read, reuse, and maintain.
Design Philosophy
Flow Render is not meant to replace the existing component model of frameworks, but rather to provide a more natural
expression for asynchronous UI interaction flows:
These steps can be organized within the same
async/awaitcode block.For interactions that cross components, hierarchies, and flows, this approach is often more intuitive.
Github: https://github.com/flow-render/flow-render
Beta Was this translation helpful? Give feedback.
All reactions