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

[labs/scoped-registry-mixin] Make compatible with subclassing #1766

Open
sorvell opened this issue Apr 18, 2021 · 1 comment
Open

[labs/scoped-registry-mixin] Make compatible with subclassing #1766

sorvell opened this issue Apr 18, 2021 · 1 comment
Milestone

Comments

@sorvell
Copy link
Member

sorvell commented Apr 18, 2021

Description

It looks like this mixin is not currently compatible with subclassing. A subclass should have it's own registry and be able to define or extend the elementDefinitions. Currently, this fails since the registry and elementDefinitions are only checked on the constructor.

To fix this, registry and elementDefinitions should be own property checks. In addition we need to provide some mechanism to extend elementDefinitions. We can either require users to explicitly add the super.elementDefinitions or do automatic composition as is done for properties.

@kevinpschaaf kevinpschaaf added this to the Lit 2.1 milestone Aug 20, 2021
@kevinpschaaf kevinpschaaf removed their assignment Jan 15, 2022
@sorvell sorvell added the labs label Jan 18, 2022
@jpzwarte
Copy link
Contributor

jpzwarte commented Jun 13, 2022

Just ran into this. Causing bugs here (fortunately not in production yet). Looking at using @open-wc/scoped-elements instead. This is the code in question:

  // MonthView already uses ScopedRegistryHost
  class CustomMonthView extends MonthView {
    static elementDefinitions = {
      ...MonthView.elementDefinitions,
      'dna-overlay-trigger': OverlayTrigger,
      'dna-tooltip': Tooltip
    };

    renderDay(day) {
      // custom render here
    }
  }

  customElements.define('custom-month-view', CustomMonthView);

@kevinpschaaf kevinpschaaf changed the title [scoped-registry-mixin] Make compatible with subclassing [labs/scoped-registry-mixin] Make compatible with subclassing Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Triaged
Development

No branches or pull requests

4 participants