Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/data/lovelace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ export type ActionConfig =
| MoreInfoActionConfig
| NoActionConfig;

export const fetchConfig = (hass: HomeAssistant): Promise<LovelaceConfig> =>
export const fetchConfig = (
hass: HomeAssistant,
force: boolean
): Promise<LovelaceConfig> =>
hass.callWS({
type: "lovelace/config",
force,
});

export const migrateConfig = (hass: HomeAssistant): Promise<void> =>
Expand Down
14 changes: 9 additions & 5 deletions src/panels/lovelace/ha-panel-lovelace.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Lovelace extends localizeMixin(PolymerElement) {
route="[[route]]"
config="[[_config]]"
columns="[[_columns]]"
on-config-refresh="_fetchConfig"
on-config-refresh="_forceFetchConfig"
></hui-root>
</template>
<template
Expand All @@ -48,7 +48,7 @@ class Lovelace extends localizeMixin(PolymerElement) {
narrow="[[narrow]]"
show-menu="[[showMenu]]"
>
<paper-button on-click="_fetchConfig"
<paper-button on-click="_forceFetchConfig"
>Reload ui-lovelace.yaml</paper-button
>
</hass-error-screen>
Expand Down Expand Up @@ -96,7 +96,7 @@ class Lovelace extends localizeMixin(PolymerElement) {
}

ready() {
this._fetchConfig();
this._fetchConfig(false);
this._updateColumns = this._updateColumns.bind(this);
this.mqls = [300, 600, 900, 1200].map((width) => {
const mql = matchMedia(`(min-width: ${width}px)`);
Expand All @@ -113,9 +113,13 @@ class Lovelace extends localizeMixin(PolymerElement) {
this._columns = Math.max(1, matchColumns - (!this.narrow && this.showMenu));
}

async _fetchConfig() {
_forceFetchConfig() {
this._fetchConfig(true);
}

async _fetchConfig(force) {
try {
const conf = await fetchConfig(this.hass);
const conf = await fetchConfig(this.hass, force);
this.setProperties({
_config: conf,
_state: "loaded",
Expand Down