nuxt-community / composition-api

Composition API hooks for Nuxt 2.
https://composition-api.nuxtjs.org
MIT License
706 stars 101 forks source link

fix: Can't pass object to template after update the version from 0.32.0 to 0.33.x #728

Open emretepedev opened 1 year ago

emretepedev commented 1 year ago

🐛 The bug I can't pass an object to the template after updating the version from 0.32.0 to 0.33.0.

🛠️ To reproduce in {root}/components/Header.vue

<template>
  <div>
    <nuxt-link v-for="page in data.pages" :key="page.title" :to="page.to">
      {{ page.title }}
    </nuxt-link>
  </div>
</template>

<script>
  import { defineComponent } from '@nuxtjs/composition-api'

  export default defineComponent({
    setup() {
      return {
        data: {
          pages: [
            { title: 'Title 1', to: 'To 1' },
            { title: 'Title 2', to: 'To 2' },
          ],
        },
      }
    },
  })
</script>

I got this error: Cannot read properties of undefined (reading 'pages')

My project is public. The original repository here.

🌈 Expected behaviour I would expect it to work as it did in version 0.32.0.

rebinnaf commented 1 year ago

Also if I pass object in props I can't access it in setup, unfortunately the example sandbox is not working to reproduce it :/

danielroe commented 1 year ago

Would you provide a reproduction? 🙏

rchl commented 1 year ago

We'd probably also need a codesanbox that uses this module since there is only one with Nuxt bridge.

That said, I can't reproduce this issue locally. Works just fine for me.

rebinnaf commented 1 year ago

I checked it more, I think my issue is different from this, I created another issue and reproduced it: https://github.com/nuxt-community/composition-api/issues/750

It would be nice to have the codesandbox template more accessible.

Thanks!