Comments (3)
So upon completing the conversion, I realized there is some separation to do with respect to server-side vs client-side component rendering. We have these scenarios:
- Server-side only components. For example, a
<new-relic>
element in the layout page. - Client-side only components. In other words, a component that
server-components
does not render, but does handle that component's asset dependencies. - Pre-rendered components. A combination of the above; a component that does some work server-side, and leaves behind a component to be run on the client.
It just occurred to be that server-components
will run a registered custom element server-side no matter what (# 3). A 3rd party package should be able to define one of the above 3 options, meaning that some code needs to be able to run in both the client or browser.
from server-components.
Ok, thanks for looking at this @mindeavor! Now that v1 has been accepted everywhere I'm definitely keen on including that as the standard here.
I think there's two issues that we're conflating slightly, and I'd like to solve them one at a time. First the move to v1, and second moving to a move substantial and thorough polyfill, rather than a home-grown solution.
Let's leave the polyfill for now (and track on #21), and move to v1 first.
I'm not sure why this move requires us to separate those three scenarios. I'd quite like a solution where we just don't care which of this is happening - the only difference we should need is to wait until a certain point before considering the result as 'rendered'. That's where the portability magic comes in.
I think doing that in the connectedCallback is fine, and fits nicely with the spirit of the spec. If you render an element with only a constructor, we consider it 'done' as soon as the constructor returns. If you render an element with a connectedCallback, we consider it done once we've called the connectedCallback, and it has either returned nothing or a promise that's been fulfilled.
Does that make sense? Is there anything that blocks this with that change alone?
If we're good to do that, I'd like to start by manually making the change in the existing quick implementation, along with tests to cover the essential behaviours, and then we can subsequently look at swapping out the implementation for a polyfill (and keep the tests passing en route).
from server-components.
I think the different scenarios I have in mind are actually a small (but useful!) extension to the original server-components
vision; basically, components that are meant to run only on the server and never show up on the client. I will create an issue about and expand on this later.
from server-components.
Related Issues (20)
- Allow rendering of fragments
- Support type extension elements HOT 1
- Document the exact differences with real web components HOT 2
- Come up with easy standard patterns for component registration (components.use(require('my-component')))
- Make it easy to integrate server components and templating libraries like Mustache for data HOT 1
- Make it easy to integrate with Express
- Design an approach to isometric component support HOT 4
- Make example code from README runnable, with TonicDev or similar HOT 2
- Create a standalone example express project
- Put together an ascii cinema setup demo
- Add MutationObserver to Domino
- Move to wrapping a standard custom elements polyfill HOT 1
- Move website onto DNS.js.org
- Build a TODO MVC style demo app
- Event Handling on Server-Components doesnt work HOT 3
- Example with ES6 imports HOT 2
- Is this project abandoned? HOT 2
- template support HOT 1
- data binding, ex: table
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from server-components.