fix: Timer für jeder KÜ separate und nicht eine für alle, aktuell wird prozentzahl bei allen das gleiche angezeigt
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import { useAppDispatch } from "@/redux/store";
|
||||
import { setEvents } from "@/redux/slices/deviceEventsSlice";
|
||||
import {
|
||||
setEvents,
|
||||
initPersistedTimings,
|
||||
} from "@/redux/slices/deviceEventsSlice";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -18,6 +21,25 @@ export default function DeviceEventsBridge() {
|
||||
|
||||
React.useEffect(() => {
|
||||
let lastSig = "";
|
||||
// Hydrate persisted timings once
|
||||
try {
|
||||
const raw =
|
||||
typeof window !== "undefined" &&
|
||||
localStorage.getItem("deviceEventsTimingsV1");
|
||||
if (raw) {
|
||||
const parsed = JSON.parse(raw);
|
||||
dispatch(
|
||||
initPersistedTimings({
|
||||
loop: parsed.loop,
|
||||
tdr: parsed.tdr,
|
||||
compare: parsed.compare || parsed.align,
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("DeviceEventsBridge hydration failed", e);
|
||||
}
|
||||
const readAndDispatch = () => {
|
||||
const ksx = Array.isArray(window.loopMeasurementEvent)
|
||||
? window.loopMeasurementEvent
|
||||
|
||||
Reference in New Issue
Block a user