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

feat(ssr): render portals #714

Merged
merged 7 commits into from
Feb 15, 2020
Merged

feat(ssr): render portals #714

merged 7 commits into from
Feb 15, 2020

Conversation

dsseng
Copy link
Contributor

@dsseng dsseng commented Feb 10, 2020

It's probably not the best possible solution, so I'm waiting for comments for improvements.

Copy link
Member

@yyx990803 yyx990803 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be more flexible to get portal content like this:

const portals = {}
const html = await renderToString(app, portals)
console.log(portals['#modal'])

@dsseng
Copy link
Contributor Author

dsseng commented Feb 13, 2020

@yyx990803 should they be then received by server rendering code and moved where required, right? I can do that.

packages/server-renderer/src/renderToString.ts Outdated Show resolved Hide resolved
packages/server-renderer/src/renderToString.ts Outdated Show resolved Hide resolved
@yyx990803
Copy link
Member

I was testing this locally and realized it's better to pass the ssr context via the app context instead. Handles concurrency and doesn't require nested passing.

The previous passing implementation would also require the compiler to generate different code (in order for renderComponent calls used in ssr render functions to use the correct context)

@yyx990803 yyx990803 merged commit e495fa4 into vuejs:master Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants