3 ms·
But does it actually work that way? If I `await fetch_from_api()` in the first component before returning the tree with the second component that fetches from m
by rafram 2y ago
But does it actually work that way? If I `await fetch_from_api()` in the first component before returning the tree with the second component that fetches from my backend, `fetch_from_api()` has to resolve before Htmy finds out about the second component.
- physicsguy 2y agoYou’d have to structure it differently, it’s definitely not a free lunch
- rafram 2y agoRight, but if this framework enabled that optimization, I’d expect it to have some examples showing how you’d implement it. As far as I can tell, there’s no way to structure your code to allow parallel component rendering with this framework.
- volfpeter 2y agoWith the current renderer (which is super basic because simplicity and features were the main priority over optimization for now), if a component has multiple async children, they will be resolved concurrently. I assume that's what you meant by "parallel". Not sure why that would need an example, but you can simply create a component that calls asyncio.sleep(1), then create a bunch of instances and render them to test it. I want to have at least the same level of concurrency when the new, better optimized renderer lands.