DEV Community


Discussion on: Introducing the Marko Tags API Preview

ryansolid profile image
Ryan Carniato Author • Edited

Yeah while Marko and Solid have a shared understanding of the mechanical aspects of frameworks, including the role of reactive language and disappearing components, there are a lot differences.

In Marko, async is handled with an <await> tag that accepts a promise and displays a placeholder. It runs on the server and streams the result when it resolves into the browser.

For Marko 6 we want to do better to allow client side fetching as well. For that we intend to introduce an tag which acts as a boundary (think Suspense) and to be consistent with everything being simple values, instead of resources we will use the compiler to detect await keyword and use that to register promises inside the boundaries. In so you will be using promises directly in your code. But more often than not it will just feed into a <const> that will trigger the tag above and render the placeholder and resolve when it completes.

<attrs/{ userId }/>
<const/user = await fetchUser(userId) />
Enter fullscreen mode Exit fullscreen mode

This will be more difficult to port back into Marko 5 given the potential for wasted re-renders of the VDOM. In Marko 6's granular system (more similar to Solid) only what needs to re-reruns. We have more details to work through as async is one of the last things we are tackling but I hope that we atleast get the simple(non-concurrent) client version working during the preview time period.

doeixd profile image

Thanks. That cleared things up for me.