mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +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
|
||||
| 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> =>
|
||||
|
@ -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
|
||||
@ -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>
|
||||
@ -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)`);
|
||||
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user