You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! As previously discussed, it would be nice to be able to specify a skeleton for server components. I use the word skeleton and not "loading" because it is not really primarily for loading. Though it can also be used as a loading state for server components, it is also very useful in places where JS is not available (like when prefetching HTML, web scrapers (and SEO stuff), page fragment links, for users with JS disabled, etc.).
I know this may not directly correlate to v5 code, but in v4 adding support for this required just one line of code:
varLustreServerComponent=classextendsHTMLElement{staticgetobservedAttributes(){return["route"];}constructor(){super();this.attachShadow({mode: "open"});this.shadowRoot.innerHTML='<slot name="skeleton"></slot>';// <- this is the one new line!this.#observer =newMutationObserver((mutations)=>{// ...});}// ...}
If you think this is a good practice, the server_component.component function could also be changed to take a skeleton element list (could be passed as [] if not wanted) to encourage users to provide one.
The text was updated successfully, but these errors were encountered:
Hello! As previously discussed, it would be nice to be able to specify a skeleton for server components. I use the word skeleton and not "loading" because it is not really primarily for loading. Though it can also be used as a loading state for server components, it is also very useful in places where JS is not available (like when prefetching HTML, web scrapers (and SEO stuff), page fragment links, for users with JS disabled, etc.).
I know this may not directly correlate to v5 code, but in v4 adding support for this required just one line of code:
Then, it can be used like:
For user-discoverability and ease, I might suggest adding a
skeleton
function to theserver_component
module, which could be like so:which could then easily be used like:
If you think this is a good practice, the
server_component.component
function could also be changed to take a skeleton element list (could be passed as[]
if not wanted) to encourage users to provide one.The text was updated successfully, but these errors were encountered: