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

Granular SSR/client rendering of components #34

Closed
galvez opened this issue Jul 6, 2019 · 5 comments
Closed

Granular SSR/client rendering of components #34

galvez opened this issue Jul 6, 2019 · 5 comments

Comments

@galvez
Copy link

galvez commented Jul 6, 2019

This is a petition to move nuxt-static-render to the nuxt-community namespace.

nuxt-static-render is a lightweight, Nuxt-targeted alternative to vue-lazy-hydrate. It offers the ability to render components on the server without delivering the data used in __NUXT__, with optional ability to rehydrate on the client only if needed.

<template>
  <div class="wrapper">
    <nuxt-static-render class="top">
      <div>{{ $staticData.foobar }}</div>
    </nuxt-static-render>
    <div class="bottom" @click="counter++">
      <div>
        <p>This component should remain operational.<p>
        <p>Here's a counter: {{ counter }}. Click to increment.</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  serverData() {
    return {
      foobar: 'This should not be in __NUXT__'
    }
  },
  asyncData() {
    return {
      counter: 1
    }
  }
}
</script>

Moreover, due to the simplicity of the implementation and small footprint of the module, perhaps we can also considering add a <nuxt-render> core built-in?

@husayt
Copy link

husayt commented May 11, 2020

@galvez what is different between this and #22. The latter is about to be release shortly.

@pi0
Copy link
Member

pi0 commented May 12, 2020

@husayt With full static, we still have a payload which includes server data and hydration happens for all nodes. This RFC is to avoid transferring unnecessary data to client side and extra hydration

@ElMatella
Copy link

Quick question, when navigation happens on client side, does the serverData hook triggers on client side to hydrate html?

@jpsc
Copy link

jpsc commented Jan 13, 2021

Will nuxt-static-render still be relevant when Vue 3 is added with partial hydration?

@galvez
Copy link
Author

galvez commented Jan 22, 2021

@jpsc I don't think so.

@galvez galvez closed this as completed Jan 22, 2021
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

No branches or pull requests

5 participants