-
Notifications
You must be signed in to change notification settings - Fork 247
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
feat: dedupe meta objects by VMID #282
Conversation
It should yes |
Codecov Report
@@ Coverage Diff @@
## master #282 +/- ##
=========================================
+ Coverage 40.15% 40.6% +0.44%
=========================================
Files 18 18
Lines 264 266 +2
=========================================
+ Hits 106 108 +2
Misses 158 158
Continue to review full report at Codecov.
|
@@ -64,6 +66,10 @@ export default function getComponentOption (opts, result = {}) { | |||
|
|||
return metaObject | |||
}) | |||
result.meta = uniqBy( | |||
result.meta.reverse(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to reverse the list to always consider the last meta object as the "true" one
@@ -64,6 +66,10 @@ export default function getComponentOption (opts, result = {}) { | |||
|
|||
return metaObject | |||
}) | |||
result.meta = uniqBy( | |||
result.meta.reverse(), | |||
metaObject => metaObject.hasOwnProperty(tagIDKeyName) ? metaObject[tagIDKeyName] : uniqueId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to implement a workaround for tags without vmid
set at all (which is common if you want to multiple tags of the same type)
My first idea was to use Symbol
but it is not supported in IE :(
So I had to use another lodash fn
related: nuxt/nuxt#4282
Whether or not that feature should be supported by vue-meta is another thing to discuss.