Skip to content

Commit

Permalink
Fixes and guards for rendering ChatFeed and Card (#6177)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Jan 10, 2024
1 parent d40dd3b commit f4c947d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion panel/chat/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ def _get_model(
self, doc: Document, root: Model | None = None,
parent: Model | None = None, comm: Comm | None = None
) -> Model:
return self._card._get_model(doc, root, parent, comm)
model = self._card._get_model(doc, root, parent, comm)
ref = (root or model).ref['id']
self._models[ref] = (model, parent)
return model

def _cleanup(self, root: Model | None = None) -> None:
self._card._cleanup(root)
Expand Down
3 changes: 1 addition & 2 deletions panel/models/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export class CardView extends ColumnView {
connect_signals(): void {
super.connect_signals()

const {active_header_background, children, collapsed, header_background, header_color, hide_header} = this.model.properties
this.on_change(children, () => this.render())
const {active_header_background, collapsed, header_background, header_color, hide_header} = this.model.properties
this.on_change(collapsed, () => this._collapse())
this.on_change([header_color, hide_header], () => this.render())

Expand Down
2 changes: 2 additions & 0 deletions panel/theme/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def _apply_params(cls, viewable, mref, modifiers, document=None):
# this may end up causing issues.
from ..io.resources import CDN_DIST, patch_stylesheet

if mref not in viewable._models:
return
model, _ = viewable._models[mref]
params = {
k: v for k, v in modifiers.items() if k != 'children' and
Expand Down

0 comments on commit f4c947d

Please sign in to comment.