Skip to content

Commit 02c9ffd

Browse files
committed
refactor: add private property for detecting mixin
1 parent 1167546 commit 02c9ffd

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/dashboard/src/vaadin-dashboard-helpers.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,5 @@ export function findAncestorInstance(node, baseClass) {
144144
* @returns {HTMLElement | null}
145145
*/
146146
export function getParentLayout(node) {
147-
return __findFilteredAncestorInstance(node, (el) => {
148-
return (
149-
el.constructor && (el.constructor.is === 'vaadin-dashboard' || el.constructor.is === 'vaadin-dashboard-layout')
150-
);
151-
});
147+
return __findFilteredAncestorInstance(node, (el) => el.__hasVaadinDashboardLayoutMixin);
152148
}

packages/dashboard/src/vaadin-dashboard-layout-mixin.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ export const DashboardLayoutMixin = (superClass) =>
2020
class DashboardLayoutMixinClass extends ResizeMixin(superClass) {
2121
static get properties() {
2222
return {
23+
/**
24+
* Used for mixin detection because `instanceof` does not work with mixins.
25+
*
26+
* @private
27+
* @type {boolean}
28+
*/
29+
__hasVaadinDashboardLayoutMixin: {
30+
value: true,
31+
},
32+
2333
/**
2434
* Whether the dashboard layout is dense.
2535
*

0 commit comments

Comments
 (0)