fix: build fix webversion 1.6.337 TDR-Einstellung Modal und Digitale Ausgänge

This commit is contained in:
ISA
2025-05-02 08:21:15 +02:00
parent 1363445388
commit 7834bbca39
3 changed files with 10 additions and 17 deletions

View File

@@ -1,4 +1,9 @@
"use client";
declare global {
interface Window {
__tdrCache?: Record<string, { data: any; tdrActive: boolean }>;
}
}
import React, { useState, useEffect } from "react";
import { useSelector } from "react-redux";
@@ -17,7 +22,9 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
window.__tdrCache = window.__tdrCache || {};
}
const cachedTdr =
typeof window !== "undefined" ? window.__tdrCache[cacheKey] : null;
typeof window !== "undefined"
? window.__tdrCache?.[cacheKey] ?? null
: null;
const [tdrData, setTdrData] = useState(
() =>
@@ -36,7 +43,7 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
const updateCache = (data: typeof tdrData, active = tdrActive) => {
if (typeof window !== "undefined") {
window.__tdrCache[cacheKey] = {
(window.__tdrCache ??= {})[cacheKey] = {
data,
tdrActive: active,
};