Skip to content

SSR guide #864

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

Merged
merged 13 commits into from
Feb 24, 2021
Merged

SSR guide #864

merged 13 commits into from
Feb 24, 2021

Conversation

NataliaTepluhina
Copy link
Member

Description of Problem

This is the first PR to start with Server side rendering guide. This particular one covers only the most basic SSR - without templating, without any bundler. I plan to extend this section in the follow-up PRs.

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

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

I've made a few small suggestions inline.

I had two other thoughts:

  1. If we're going to merge this as we go then we should probably have a disclaimer at the top of each page warning that the guide is incomplete.
  2. I got a little bit confused by the Express example. The example itself is fine but it doesn't include any client-side hydration. There should probably be a note somewhere that we're only dealing with the server part for now and hydration will be covered later.

On a loosely related note, the API Reference for mount suggests that it takes a second argument called isHydrate. When I tried playing with SSR myself that threw me for a while. As far as I can tell that isn't true, it only takes a single argument and you just use createSSRApp in the client code to trigger hydration. Perhaps something to update when the relevant SSR bits are added to the API Reference.

Unlike Vue client-only application, SSR one should use a different method for creating an application instance: instead of `createApp` we need to use `createSSRApp`.

```js
// server.js
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing the point of this line is to remind the reader that this is server-side Node code? If that is the intention then perhaps it'd be better to state it explicitly rather than implying it via a file name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed it altogether as it's a bit early to explain about Node code before we dropped an Express name


## Integrating with a Server

To run an application, [Express](https://expressjs.com/):
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there meant to be more to this sentence? Maybe something explaining that you don't have to use Express but we're going to use it to complete the example on this page?

Copy link
Member Author

Choose a reason for hiding this comment

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

Extended a bit

@NataliaTepluhina
Copy link
Member Author

@skirtles-code I've added a few sentences and a disclaimer to show the guide is incomplete. As for hydration: it seems in the previous guide it was covered in webpack build, do you think we should have it before?

@skirtles-code
Copy link
Contributor

@NataliaTepluhina I'm not sure how to cover hydration without a build. I tried to create the simplest example I could that used client-side hydration but I don't think it would make for a good documentation example:

https://github.com/skirtles-code/vue-3-ssr-example-no-build

In practice I can't imagine anyone wanting to do it that way and the tricks I used to get it to work are more likely to confuse someone rather than clarifying anything.

I think the paragraph you've added to the end of the current page explaining that client-side hydration will be explained later is sufficient to avoid confusion.

@skirtles-code skirtles-code merged commit 799b2c8 into master Feb 24, 2021
@skirtles-code skirtles-code deleted the ssr-guide branch February 24, 2021 11:22
edimitchel added a commit to edimitchel/docs-fr that referenced this pull request Jan 2, 2024
edimitchel added a commit to edimitchel/docs-fr that referenced this pull request Jan 2, 2024
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