Skip to content

Commit

Permalink
Load ha-markdown on render and improved subscribe logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetchnnel committed Sep 17, 2020
1 parent b78500d commit acde099
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lovelace-home-feed-card.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ class HomeFeedCard extends LitElement {

connectedCallback() {
super.connectedCallback();
this._unsubNotifications = this._hass.connection.subscribeEvents(() => {
this.refreshNotifications().then(() => {});
}, "persistent_notifications_updated");
window.hassConnection.then(c => {
this._unsubNotifications = c.conn.subscribeEvents(() => {
this.refreshNotifications().then(() => {});
}, "persistent_notifications_updated");
});
}

disconnectedCallback() {
Expand Down Expand Up @@ -189,6 +191,9 @@ class HomeFeedCard extends LitElement {
}
else{
if(this.feedContent != null){
// Create a dummy Markdown card to ensure that hui-markdown-card and ha-markdown are loaded
createCard({"type": "markdown", "content": "**dummy Markdown card**"});

if(this.feedContent.length === 0 && this._config.show_empty === false){
this.style.display = "none";

Expand Down

0 comments on commit acde099

Please sign in to comment.