Skip to content

Commit

Permalink
Fix ESM component module resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 3, 2025
1 parent 935acd4 commit ab78abc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions panel/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .reactive import ( # noqa
Reactive, ReactiveCustomBase, ReactiveHTML, ReactiveMetaBase,
)
from .util import camel_to_kebab, classproperty
from .util import classproperty
from .util.checks import import_available
from .viewable import ( # noqa
Child, Children, Layoutable, Viewable, Viewer, is_viewable_param,
Expand Down Expand Up @@ -429,7 +429,7 @@ def _get_properties(self, doc: Document | None) -> dict[str, Any]:
data_props['esm_constants'] = self._constants
props.update({
'bundle': bundle_hash,
'class_name': camel_to_kebab(cls.__name__),
'class_name': cls.__name__,
'data': self._data_model(**{p: v for p, v in data_props.items() if p not in ignored}),
'dev': config.autoreload or getattr(self, '_debug', False),
'esm': self._render_esm(not config.autoreload, server=is_session),
Expand Down
6 changes: 3 additions & 3 deletions panel/models/reactive_esm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class ReactiveESMView extends HTMLBoxView {
this.invalidate_render()
})
this.on_change(class_name, () => {
this.container.className = this.model.class_name
this.container.className = this.model.class_name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
})
const child_props = this.model.children.map((child: string) => this.model.data.properties[child])
this.on_change(child_props, () => {
Expand Down Expand Up @@ -658,8 +658,8 @@ export class ReactiveESM extends HTMLBox {
}
try {
let initialize
if (this.bundle != null && (mod.default || {}).hasOwnProperty(this.name)) {
mod = mod.default[(this.name as any)]
if (this.bundle != null && (mod.default || {}).hasOwnProperty(this.class_name)) {
mod = mod.default[(this.class_name as any)]
}
if (mod.initialize) {
initialize = mod.initialize
Expand Down

0 comments on commit ab78abc

Please sign in to comment.