Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Avoid using object as key, use primitive instead #5

@riker09

Description

@riker09

Great plugin, I enjoy using it. However, I installed a fresh copy directly from npm (npm install --save vue-notifyjs) and it fetched version 0.1.7. I was getting warnings in my browsers console that stated the key should not be a complex but a primitive type like string or integer.

Looking in the source code of the module in my node_modules/vue-notifyjs/dist I could find the culprit rather easy:

                        component: notification.component,
                        timestamp: notification.timestamp
                    },
                    key: notification, on: {
                        'close': function close() {
                            return _this.removeNotification(index);
                        }
                    }

I've manually changed key: notification to key: index and the error was gone. Now the funky bits click in: I forked your repo on GitHub and tried to create a pull request. But then I saw that your source code already contains a fix: You use the timestamp value of the notification to create a unique key. Very nice, but why is this not included on the NPM repo? I have never published anything on NPM so I can only assume that maybe you've uploaded the wrong version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions