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

Vue meta and serverCacheKey (LRU Caching) #190

Closed
mattickx opened this issue Feb 19, 2018 · 3 comments
Closed

Vue meta and serverCacheKey (LRU Caching) #190

mattickx opened this issue Feb 19, 2018 · 3 comments

Comments

@mattickx
Copy link

mattickx commented Feb 19, 2018

I'am seeing wrong meta data when using LRU caching and SSR.
Setting a serverCacheKey in a component's options, will cache the component server side.

Case:
Let's say we have a component A and B with both a serverCacheKey and a different vue meta title.

The following:

<template>
   <A>
      <B></B>
   </A>
</template>

Will result in:
The first load the rendered meta title will be Title B.
A second reload (cache hit) will render title A.

I know this is related to SSR Caching and not directly to Vue Meta.
Still, it would be helpful as I encountered this use case, as such others might aswel.
An example in the docs would do wonders 👍

Request:
SSR + Caching (LRU) components and keep rendering the correct metadata even on a cache hit.

@pimlie
Copy link
Collaborator

pimlie commented Mar 8, 2019

I am not sure what we could do to fix this as afaik Vue doesnt emit any events when a component is re-used from cache? The docs also mention you shouldnt use component caching when child components produce side effects (which is what vue-meta does): https://ssr.vuejs.org/guide/caching.html#when-to-use-component-caching

But if anyone has an idea for a workaround we are open to suggestions ofc!

Btw, probably not what you need but client side the correct meta title will be displayed once the fix for #283 is released

@stale
Copy link

stale bot commented Apr 23, 2019

Thanks for your contribution to vue-meta! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of vue-meta
  2. Comment the steps to reproduce it
    Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Apr 23, 2019
@stale stale bot closed this as completed Apr 30, 2019
@JUST-Limbo
Copy link

i think:when vue instance lifecycle hooks were called,vue-meta power function will be called at the same time.
so if your nested component use cache,at the first time,you can get the correct metainfo.
but metainfo get [undefined] at the second time,because the cached component instance lifecycle hooks did not be called.
so many years have passed, and surprisingly few people have mentioned this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants