api-platform / create-client

Generate React or Vue.js-based Progressive Web Apps from an Hydra-enabled API. Also support React Native.
https://api-platform.com/docs/client-generator/
MIT License
373 stars 132 forks source link

vue errors: update(edit) object #239

Closed sergerdn closed 1 year ago

sergerdn commented 3 years ago

API Platform version(s) affected: 0.5.1

Description

vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError: this.$store.getters[getterType] is not a function"

found in

---> <BookForm> at src/components/book/Form.vue
       <Update> at src/components/book/Update.vue
         <App> at src/App.vue
           <Root>
....
vue.runtime.esm.js?2b0e:1888 TypeError: this.$store.getters[getterType] is not a function
    at VueComponent.get (index.esm.js?5935:142)
    at Watcher.get (vue.runtime.esm.js?2b0e:4479)
    at Watcher.evaluate (vue.runtime.esm.js?2b0e:4584)
    at VueComponent.computedGetter [as reviewsSelectItems] (vue.runtime.esm.js?2b0e:4836)
    at Object.get (vue.runtime.esm.js?2b0e:2072)
    at Proxy.render (eval at ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"0912cad0-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/book/Form.vue?vue&type=template&id=4b4d936a& (app.js:1082), <anonymous>:268:22)
    at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548)
    at VueComponent.updateComponent (vue.runtime.esm.js?2b0e:4066)
    at Watcher.get (vue.runtime.esm.js?2b0e:4479)
    at new Watcher (vue.runtime.esm.js?2b0e:4468)
....
vuex.esm.js?2f62:493 [vuex] unknown action type: reviews/list/getSelectItems

How to reproduce

Additional Context
Screenshot 2020-11-12 at 01 15 58

How to fix

src/components/book/Form.vue: Left - bad, Right side - fixes Screenshot 2020-11-12 at 04 22 50

mbrodala commented 3 years ago

Notice that the actual error in my case was that I renamed the Vuex store module on import which did cause a mismatch. Based on a MyResource resource the module was generated as myresource which I did import as myResource and using the ES shortcut notation lead to myResource being used as store module key. Sticking to the import suggested by the generator fixed my issue.