vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.7k stars 33.67k forks source link

partial ssr rendering #5787

Closed FranckFreiburger closed 7 years ago

FranckFreiburger commented 7 years ago

What problem does this feature solve?

1/ Many component are not (yet) compatible with ssr and may require large changes to support it. Partial ssr rendering could allow to use these component meanwhile they are eventually "ported". The directives could also benefit from this behavior.

2/ Some components may not be mandatory for SEO, this could allow a better client-side/server-side load balance.

What does the proposed API look like?

a vue component:

<template>
...
</template>
<script>
export default {
  allowServerSideRendering: false
  ...
}
</script>
LinusBorg commented 7 years ago

You can pretty easily define a wrapper component that keeps components from rendering during SSR (and postpones rendering on the client so hydration works correctly)

@egoist did this in like 5 lines of code: https://github.com/egoist/vue-no-ssr

This could be a viable workaround for you while your request is being discussed here.

atom110436 commented 7 years ago

Get เมื่อ 30 พ.ค. 2017 16:24, "Franck Freiburger" notifications@github.com เขียนว่า:

What problem does this feature solve?

1/ Many component are not (yet) compatible with ssr and may require large changes to support it. Partial ssr rendering could allow to use these component meanwhile they are eventually "ported". The directives could also benefit from this behavior.

2/ Some components may not be mandatory for SEO, this could allow a better client-side/server-side load balance. What does the proposed API look like?

a vue component:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vuejs/vue/issues/5787, or mute the thread https://github.com/notifications/unsubscribe-auth/AaCx-bJEjZ9b3SqGV4yQqs-KRMao-DQRks5r--BTgaJpZM4NqCCV .

FranckFreiburger commented 7 years ago

Thanks, this is fine for me !