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

names conflict error #20

Closed
l0rda opened this issue Feb 9, 2017 · 11 comments
Closed

names conflict error #20

l0rda opened this issue Feb 9, 2017 · 11 comments
Assignees

Comments

@l0rda
Copy link

l0rda commented Feb 9, 2017

Hello,

when i'm using 2 or more instances of one vue component with notifications block, i got error in console:

VueNotifications: names conflict - showMyCustomerError

@se-panfilov
Copy link
Owner

Hello, @l0rda
Thanks for your feedback.

To be honest, I'm not sure if I'm able to fix this issue in current version of vue-notifications.
Because by design vue-notifications shall be used on single-instanced components, such as "pages".

But I'll take a look if I can do something with it.

P.S. Right now I'm working on next iteration of vue-notifictions that won't have such problems. Would be smaller and much more straight forward.

P.P.S. Basically that error happens when component's instance already have method with such name ("showMyCustomerError" in your case). It's looks like vue-notifications tried to add same method for the component at least twice.

@se-panfilov se-panfilov self-assigned this Mar 1, 2017
@dkcwd
Copy link

dkcwd commented Mar 7, 2017

Hey @se-panfilov and @l0rda, just thought I'd share that I ran into the same thing and decided to use https://www.npmjs.com/package/vue-geb to centralise notification handling.

As an example of a quick implementation:

In your "main" page

  created: function () {
    // listen only to events emitted with the id 'vue-notification'
    this._notificationSub = this.$geb.getFilteredBus({id: 'vue-notification'}).subscribe(this.processNotification)
  },
  destroyed: function () {
    // avoid memory leaks by removing the subscription when destroyed
    if (this._notificationSub) {
      this._notificationSub.unsubscribe()
    }
  },
  methods: {
    processNotification: function (notificationData) {
      if (typeof notificationData.payload.type === 'string') {
        this[notificationData.payload.type]()
      }
    }
  },
  // register all the required notifications
  notifications: {
    showMyCustomError: {
      title: 'Failed',
      message: 'Failed to do the thing',
      type: 'error'
    }
  },

In a component within a method which should trigger a notification

  this.$geb.emit({id: 'vue-notification', payload: {type: 'showMyCustomError'}})

@azhard4int
Copy link

@se-panfilov any ETA for the next iteration release?

@se-panfilov
Copy link
Owner

@azhard4int and all other guys.

I'll try to release new version this weekend.
Sorry for delay, but I'm on the middle of job change right now.

Anyway, just to notice you - next release will be without backward compatability

@daniplaninc
Copy link

Hi, great library, been using it for a while now (+mini-toastr). No problem whatsoever, except the names conflict (I sometimes reuse the same vue components many times on the same page). Any ETA on the next version that would resolve this issue?

@se-panfilov
Copy link
Owner

se-panfilov commented Apr 5, 2017

@daniplaninc Can you provide an example?

Sorry I'm super busy, I've try to fix it today, but it's works for me (Basically this kind of errors should happens only if it clashes with methods names)

I mean that if you'll provide an example - it helps.

@daniplaninc
Copy link

Sorry for a delayed answer. This is not a breaking issue for me, as far as I know, the only thing that happens is the error message that appears in the console ("VueNotifications: names conflict - ). My application continues to work as expected.

As far as an example goes, maybe a description is enough. I have several global components defined (Vue.component(...)) and I use them repeatedly throughout my HTML, sometimes in a v-for. On page load, the error messages about duplication appear.

So basically whenever you will release a new version I will switch to get rid of the errors, but I am in no hurry.

@natali9t9
Copy link

I receive same error, @se-panfilov do you have any news ?

@CrixuAMG
Copy link

Any news?
The console is littered with errors: screenshot

se-panfilov added a commit that referenced this issue Sep 15, 2017
#20 Fix method's names conflicts when same component used more then once
@se-panfilov
Copy link
Owner

Fixed in release 0.8.1

@CrixuAMG
Copy link

That fixed it, thanks @se-panfilov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants