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

Endless loop when querying in a global component used in markdown when using NuxtLayout #2618

Open
xvaara opened this issue Apr 22, 2024 · 2 comments

Comments

@xvaara
Copy link

xvaara commented Apr 22, 2024

Environment

Reproduction

https://stackblitz.com/edit/github-j1www5?file=content%2Findex.md,content%2Fcontact.yml,components%2FComp.global.vue,app.vue

Describe the bug

Endless loop when querying in a global component used in markdown when using NuxtLayout

Additional context

No response

Logs

[Vue warn]: Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead. 
  at <Comp.global > 
  at <AsyncComponentWrapper > 
  at <MDCRenderer body= {type: 'root', children: Array(6), toc: {…}} data= {_path: '/', _dir: '', _draft: false, _partial: false, _locale: '', …} tag="div"  ... > 
  at <ContentRendererMarkdown value= {_path: '/', _dir: '', _draft: false, _partial: false, _locale: '', …} excerpt=false tag="div" > 
  at <ContentRenderer value= {_path: '/', _dir: '', _draft: false, _partial: false, _locale: '', …} excerpt=false tag="div" > 
  at <ContentQuery path="/" find="one" > 
  at <ContentDoc> 
  at <[...slug] onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) {…} > > 
  at <Anonymous key="/" vnode= {__v_isVNode: true, __v_skip: true, type: {…}, props: {…}, key: null, …} route= {fullPath: '/', hash: '', query: {…}, name: 'slug', path: '/', …}  ... > 
  at <RouterView name=undefined route=undefined > 
  at <NuxtPage> 
  at <NuxtLayoutProvider layoutProps= {ref: RefImpl} key="default" name="default"  ... > 
  at <NuxtLayout> 
  at <App key=3 > 
  at <NuxtRoot>
@farnabaz
Copy link
Member

This is not related to Content module, try removing template inside the loop:

<ul>
      <li v-for="(item, key, index) in data.links" :key="key">
        <b> {{ key }} s{{ index }}s </b>

          <a :href="item">
            {{ item }}
          </a>
      </li>
    </ul>

@xvaara
Copy link
Author

xvaara commented Apr 24, 2024

The template was left there from a more complex componenent. The component works when called from vue file, endless loop when called from a markdown file. So if it's not related to Content module is the bug in mdc?

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

2 participants