vue-toastification icon indicating copy to clipboard operation
vue-toastification copied to clipboard

Warning (error) on initialization

Open lllopo opened this issue 3 years ago • 2 comments

Versions

  • 2.0.0-rc.5

Describe the bug

On initialisation I get : [Vue warn]: Property "positions" was accessed during render but is not defined on instance. at <VueToastification eventBus= EventBus {allHandlers: {…}} > warn @ runtime-core.esm-bundler.js:6666 get @ runtime-core.esm-bundler.js:6124 render10 @ index.mjs:969 renderComponentRoot @ runtime-core.esm-bundler.js:575 componentUpdateFn @ runtime-core.esm-bundler.js:4400 run @ reactivity.esm-bundler.js:197 setupRenderEffect @ runtime-core.esm-bundler.js:4526 mountComponent @ runtime-core.esm-bundler.js:4309 processComponent @ runtime-core.esm-bundler.js:4267 patch @ runtime-core.esm-bundler.js:3868 render @ runtime-core.esm-bundler.js:5011 mount @ runtime-core.esm-bundler.js:3262 app.mount @ runtime-dom.esm-bundler.js:1730 eval @ index.mjs:999 Promise.then (async) nextTick @ runtime-core.esm-bundler.js:6871 buildInterface @ index.mjs:997 createToastInterface @ index.mjs:1064 VueToastificationPlugin @ index.mjs:1072 use @ runtime-core.esm-bundler.js:3205 eval @ App.js:27 ./src/app/App.js @ main.js:19 __webpack_require__ @ main.js:2411 (anonymous) @ main.js:3698 __webpack_require__.O @ main.js:2460 (anonymous) @ main.js:3699 (anonymous) @ main.js:3701 index.js:551 [webpack-dev-server] Hot Module Replacement enabled. index.js:551 [webpack-dev-server] Live Reloading enabled. xhr.js:210

when using this code : `import Toast from "vue-toastification";

const appDom = document.querySelector("#app");

createApp(App, {...appDom.dataset}) .use(Toast) .mount('#app');`

even if no real toasting is done anywhere. If I also add a toast somewhere - it doesn't show up although no further errors are thrown.

Steps to reproduce

Steps:

  1. Install normally
  2. Set up plugin
  3. Use the code above

Your Environment

  • Device: PC
  • OS: windows
  • Browser Edge
  • Version 99 dev But this actually doesn't matter.

Additional context

I'm using latest of everything : "vue": "^3.2.26", "vue-router": "^4.0.12", "vuex": "^4.0.2" "vue-loader": "^17.0.0", "webpack": "^5.66.0", "webpack-dev-server": "^4.7.3"

lllopo avatar Jan 14 '22 10:01 lllopo

Aaaand I found the problem : while your plugin states it is for the composition API, it internally uses the options API for the components. So, setting VUE_OPTIONS_API to false in webpack actually breaks it.

Edit : A serious problem, though.

lllopo avatar Jan 14 '22 11:01 lllopo

Hello @lllopo ! Thanks for both reporting and finding the issue. You are correct in your assessment. Back when I wrote v2.0 for Vue 3, the testing libraries available were not mature enough to cover all cases when using composition, so I was forced to keep using options.

It has been some time since then, so I'll give it another try soon and see if it can be done.

Maronato avatar Jan 28 '22 17:01 Maronato