Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: PoC Render to string #656

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Feb 3, 2022

Just some proof of concept work to see if renderToString would be possible to facilitate server-side rendering.

Please ignore.

Related to #653

It sorta works:

What it looks like from #653 (expected) This PR (actual)

Dev notes

const view = new TimelineView(timelineViewModel);
// view.mount() now returns a string of HTML
app.insertAdjacentHTML('beforeend', view.mount());

Problems

  • Some render() functions have DOM side-effects
  • t.view(...) causes a lot of side-effects since it calls mount() (which has side-effects), then render()
    • In my use, the ListView which is an IView and does a bunch of mount document.appendChild stuff
    • A TemplateView is much more compatible since we can just render and get a string mostly

@MadLittleMods MadLittleMods marked this pull request as draft February 3, 2022 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant