salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.59k stars 386 forks source link

Asynchronous rendering #907

Open priandsf opened 5 years ago

priandsf commented 5 years ago

SSR Add an async rendering capability, which delays the actual rendering until an optional Promise provided by the component gets resolved. On the client side, the component inner DOM as generated by SSR should be preserved until the component is finally rendered. Reference: React Suspense API, .

caridy commented 5 years ago

this is very related to https://github.com/salesforce/lwc/issues/908

but I guess this is another API to allow the same capability when not using wire, but doing some regular promise in user-land, and use that as a signal to delay rendering, right? If that's the case, I will probably say no to it, but we can debate it. I think if you want to delay the rendering, you can probably use a special component that give you that, let me think more about it.

priandsf commented 5 years ago

This is correct, it is the manual version of #908 . It is similar to StencilJS componentWillLoad(https://stenciljs.com/docs/component-lifecycle#async-lifecycle-methods) or the React 17 Suspense API. I would like to better understand the special component proposal. I believe that you are suggesting a kind of a high order component. I'd like to see what the component consumer experience will be, as configuring the HOC might require some knowledge of the wrapped component implementation (what data it needs...).