salesforce / lwc

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

Deferrable Views #3882

Open AllanOricil opened 11 months ago

AllanOricil commented 11 months ago

Is your feature request related to a problem? Please describe.

obs: this feature is not the same as react|vue's suspense api. I see it as an improved version.

What if lwc devs could set props in their component to ask the framework to load its assets at a later time, and with granular control? Angular introduced it and you can read more about it below

https://angular.io/guide/defer

https://netbasal.com/a-comprehensive-guide-to-angulars-defer-block-468c74048df4

Suggestions:

  1. it could be a static prop in the component
  2. A new directive called @defer that can only be added to LightningElement classes
  3. It can be a wrapper component with the same props as in the @defer

This would probably require changes to the lwc server and bundler to enable lazy loading of assets.

nolanlawson commented 11 months ago

This seems similar to Svelte's await blocks as well.