Closed josemarluedke closed 7 years ago
Curious to know about the server side rendering with glimmer app:
Apologies my knowledge of Glimmer apps is very limited.
@kratiahuja so, at this moment I'm just experimenting and seeing what is already possible to do with Glimmer.
I have a working hello world glimmer app been rendered in the server with these changes: https://github.com/josemarluedke/glimmer-ssr-test/commit/f54bb177fa683eb2361b31b96d28431a928cc637 (Note that this example requires the changes in this PR. )
The approach I took was getting a sandbox (copied from FastBoot) then evaluating and booting the app in every request.
As far as I can tell, glimmer apps don't have the idea of application instance, so we need to do the full app boot in every request.
Hopefully some of my learnings can make back to FastBoot itself (if we would use FastBoot to render glimmer apps as well...)
That's the reason I was asking to understand if FastBoot can be used. Looks liek it will need a lot of work.
@rwjblue Updated to use simple-dom
in the test. Please check if the way I included that package makes sense.
@rwjblue I see your point on creating some test to that actually renders the application, however, it seems that the right place for such a test would be in the @glimmer/component
. See here: https://github.com/glimmerjs/glimmer-component/blob/master/test/rendering-test.ts
After landing this, I could get a PR to @glimmer/component
adding tests to use simple-dom
to render the components.
Yes, I agree that we should also add tests there, but I though since some of the tests in this repo are testing "full stack render" we could also add a high level test here too.
I wasn't thinking something like: https://github.com/glimmerjs/glimmer-application/blob/master/test/render-component-test.ts#L7...
@rwjblue Added a basic test for rendering a component using simple-dom. Let me know if there is anything else I should do in this PR.
Thank you for working through this with me @josemarluedke!
Yeah, thanks much @josemarluedke :100:
This allow some experimenting with Server Side Rendering. With this change it's possible to use
simple-dom
to render the application.Also removes all the usages of
window.document
to use the new option.