Repository: DevExpress/devextreme-vue
Pull request #241 (2019-02-07 12:14:01)

Update to vue@2.6


Patch:
diff --git a/package-lock.json b/package-lock.json
index d10a55e..e951a07 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11812,9 +11812,9 @@
       }
     },
     "vue": {
-      "version": "2.5.17",
-      "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.17.tgz",
-      "integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==",
+      "version": "2.6.3",
+      "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.3.tgz",
+      "integrity": "sha512-yftjtahz4UTAtOlXXuw7UaYD86fWrMDAAzqTdqJJx2FIBqcPmBN6kPBHiBJFGaQELVblb5ijbFMXsx0i0F7q3g==",
       "dev": true
     },
     "vue-hot-reload-api": {
@@ -11909,9 +11909,9 @@
       }
     },
     "vue-template-compiler": {
-      "version": "2.6.2",
-      "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.2.tgz",
-      "integrity": "sha512-2dBKNCtBPdx1TFef7T4zwF8IjOx2xbMNryCtFzneP+XIonJwOtnkq4s1mhKv8W79gXcGINQWtuaxituGAcuSnA==",
+      "version": "2.6.3",
+      "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.3.tgz",
+      "integrity": "sha512-SQ3lJk7fwquz8fGac7MwvP9cEBZntokTWITaDrLC0zmyBKjcOfJtWZkMsv+2uSUBDD8kwz8Bsad9xmBWaNULhg==",
       "dev": true,
       "requires": {
         "de-indent": "1.0.2",
diff --git a/package.json b/package.json
index 2346dcc..b8ca87c 100644
--- a/package.json
+++ b/package.json
@@ -52,9 +52,9 @@
     "tslint": "^5.11.0",
     "typescript": "^2.9.2",
     "url-loader": "^1.1.1",
-    "vue": "^2.5.17",
+    "vue": "^2.6.3",
     "vue-loader": "^14.2.3",
-    "vue-template-compiler": "^2.5.17",
+    "vue-template-compiler": "^2.6.3",
     "webpack": "^4.29.2",
     "webpack-cli": "^3.2.3",
     "webpack-dev-server": "^3.1.14"
diff --git a/src/core/component.ts b/src/core/component.ts
index 4643da0..447b559 100644
--- a/src/core/component.ts
+++ b/src/core/component.ts
@@ -7,7 +7,7 @@ import { pullAllChildren } from "./children-processing";
 import Configuration, { bindOptionWatchers, subscribeOnUpdates } from "./configuration";
 import { IConfigurable } from "./configuration-component";
 import { IExtension, IExtensionComponentNode } from "./extension-component";
-import { camelize, toComparable } from "./helpers";
+import { camelize, extractScopedSlots, toComparable } from "./helpers";
 
 interface IWidgetComponent extends IConfigurable {
     $_instance: any;
@@ -120,9 +120,8 @@ const BaseComponent: VueConstructor<IBaseComponent> = Vue.extend({
                 ...this.$_getExtraIntegrationOptions(),
             };
 
-            const templates = {
-                ...this.$scopedSlots
-            };
+            const templates = extractScopedSlots(this.$scopedSlots, Object.keys(this.$slots));
+
             this.$children.forEach((child: any) => {
                 if (shouldAddTemplate(child)) {
                     const templateName = `${child.$vnode.componentOptions.$_config.fullPath}.${TEMPLATE_PROP}`;
diff --git a/src/core/helpers.ts b/src/core/helpers.ts
index 5f2851f..0a4bcc4 100644
--- a/src/core/helpers.ts
+++ b/src/core/helpers.ts
@@ -25,3 +25,24 @@ export function isEqual(value1, value2) {
 
     return false;
 }
+
+export function extractScopedSlots(
+    obj: Record<string, any>,
+    nonScopedSlots: string[]
+): Record<string, any> {
+
+    const result = {};
+
+    Object.keys(obj).forEach((key: string) => {
+        if (nonScopedSlots && nonScopedSlots.indexOf(key) > -1) {
+            return;
+        }
+
+        const value = obj[key];
+        if (value instanceof Function) {
+            result[key] = value;
+        }
+    });
+
+    return result;
+}


Test patch:
diff --git a/src/core/helpers.test.ts b/src/core/helpers.test.ts
index 965d00b..3fac2d7 100644
--- a/src/core/helpers.test.ts
+++ b/src/core/helpers.test.ts
@@ -1,4 +1,4 @@
-import { isEqual, toComparable } from "./helpers";
+import { extractScopedSlots, isEqual, toComparable } from "./helpers";
 
 describe("toComparable", () => {
 
@@ -42,3 +42,33 @@ describe("isEqual", () => {
         expect(isEqual(testDate1, testDate2)).toBe(true);
     });
 });
+
+describe("extractScopedSlots", () => {
+    // https://github.com/vuejs/vue/issues/9443
+
+    it("removes non-functional fields", () => {
+        const actual = extractScopedSlots(
+            {
+                a() { return true; },
+                b: 123,
+                c: true,
+                d: undefined
+            },
+            []
+        );
+
+        expect(Object.keys(actual)).toEqual(["a"]);
+    });
+
+    it("removes non-scoped slots", () => {
+        const actual = extractScopedSlots(
+            {
+                a() { return true; },
+                b() { return true; }
+            },
+            ["b"]
+        );
+
+        expect(Object.keys(actual)).toEqual(["a"]);
+    });
+});