History: reload data after backend restart (#30985)
This commit is contained in:
parent
1582d869cc
commit
7ac3af86c2
2 changed files with 17 additions and 2 deletions
|
|
@ -154,6 +154,7 @@ export default defineComponent({
|
|||
month: { type: Number, default: undefined },
|
||||
year: { type: Number, default: undefined },
|
||||
period: { type: String as PropType<PERIODS>, default: undefined },
|
||||
offline: Boolean,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -340,6 +341,9 @@ export default defineComponent({
|
|||
fetchKey() {
|
||||
this.fetchData();
|
||||
},
|
||||
offline(offline) {
|
||||
if (!offline) this.fetchData();
|
||||
},
|
||||
rawSeries() {
|
||||
// Drop focused entries whose paletteIndex no longer matches any entity
|
||||
// in the new data (e.g. a loadpoint was filtered out after a period
|
||||
|
|
@ -498,7 +502,7 @@ export default defineComponent({
|
|||
this.displayPeriod = requestPeriod;
|
||||
} catch (e) {
|
||||
console.error("Failed to load energy history", e);
|
||||
this.rawSeries = [];
|
||||
// keep previous data on error
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { test, expect, type Page, type Locator } from "@playwright/test";
|
||||
import { start, stop, baseUrl } from "./evcc";
|
||||
import { start, stop, restart, baseUrl } from "./evcc";
|
||||
|
||||
test.use({ baseURL: baseUrl() });
|
||||
|
||||
|
|
@ -219,3 +219,14 @@ test.describe("consumption breakdown", () => {
|
|||
await expect.poll(() => yAxis(meterChart)).toEqual(["kW", "0.0", "0.3", "0.6", "0.9", "1.2"]);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("reconnect", () => {
|
||||
test("history still shows content after backend restart", async ({ page }) => {
|
||||
await gotoDay(page, 2026, 3, 24);
|
||||
await expect(chart(page, "grid")).toBeVisible();
|
||||
|
||||
await restart();
|
||||
|
||||
await expect(chart(page, "grid")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue