create-client icon indicating copy to clipboard operation
create-client copied to clipboard

vue errors: update(edit) object

Open sergerdn opened this issue 5 years ago • 1 comments

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

  • Follow https://api-platform.com/docs/client-generator/vuejs/
  • Make all things
  • Proceed to edit any Books item.

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

sergerdn avatar Nov 11 '20 22:11 sergerdn

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.

mbrodala avatar Jan 27 '21 16:01 mbrodala