Skip to content

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.

2 participants