mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Force refresh on manual refresh (#2200)
This commit is contained in:
parent
1ecb138ec5
commit
2289773e36
@ -51,9 +51,13 @@ export type ActionConfig =
|
|||||||
| MoreInfoActionConfig
|
| MoreInfoActionConfig
|
||||||
| NoActionConfig;
|
| NoActionConfig;
|
||||||
|
|
||||||
export const fetchConfig = (hass: HomeAssistant): Promise<LovelaceConfig> =>
|
export const fetchConfig = (
|
||||||
|
hass: HomeAssistant,
|
||||||
|
force: boolean
|
||||||
|
): Promise<LovelaceConfig> =>
|
||||||
hass.callWS({
|
hass.callWS({
|
||||||
type: "lovelace/config",
|
type: "lovelace/config",
|
||||||
|
force,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const migrateConfig = (hass: HomeAssistant): Promise<void> =>
|
export const migrateConfig = (hass: HomeAssistant): Promise<void> =>
|
||||||
|
@ -28,7 +28,7 @@ class Lovelace extends localizeMixin(PolymerElement) {
|
|||||||
route="[[route]]"
|
route="[[route]]"
|
||||||
config="[[_config]]"
|
config="[[_config]]"
|
||||||
columns="[[_columns]]"
|
columns="[[_columns]]"
|
||||||
on-config-refresh="_fetchConfig"
|
on-config-refresh="_forceFetchConfig"
|
||||||
></hui-root>
|
></hui-root>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
@ -48,7 +48,7 @@ class Lovelace extends localizeMixin(PolymerElement) {
|
|||||||
narrow="[[narrow]]"
|
narrow="[[narrow]]"
|
||||||
show-menu="[[showMenu]]"
|
show-menu="[[showMenu]]"
|
||||||
>
|
>
|
||||||
<paper-button on-click="_fetchConfig"
|
<paper-button on-click="_forceFetchConfig"
|
||||||
>Reload ui-lovelace.yaml</paper-button
|
>Reload ui-lovelace.yaml</paper-button
|
||||||
>
|
>
|
||||||
</hass-error-screen>
|
</hass-error-screen>
|
||||||
@ -96,7 +96,7 @@ class Lovelace extends localizeMixin(PolymerElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ready() {
|
ready() {
|
||||||
this._fetchConfig();
|
this._fetchConfig(false);
|
||||||
this._updateColumns = this._updateColumns.bind(this);
|
this._updateColumns = this._updateColumns.bind(this);
|
||||||
this.mqls = [300, 600, 900, 1200].map((width) => {
|
this.mqls = [300, 600, 900, 1200].map((width) => {
|
||||||
const mql = matchMedia(`(min-width: ${width}px)`);
|
const mql = matchMedia(`(min-width: ${width}px)`);
|
||||||
@ -113,9 +113,13 @@ class Lovelace extends localizeMixin(PolymerElement) {
|
|||||||
this._columns = Math.max(1, matchColumns - (!this.narrow && this.showMenu));
|
this._columns = Math.max(1, matchColumns - (!this.narrow && this.showMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
async _fetchConfig() {
|
_forceFetchConfig() {
|
||||||
|
this._fetchConfig(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
async _fetchConfig(force) {
|
||||||
try {
|
try {
|
||||||
const conf = await fetchConfig(this.hass);
|
const conf = await fetchConfig(this.hass, force);
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
_config: conf,
|
_config: conf,
|
||||||
_state: "loaded",
|
_state: "loaded",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user