some hotfixes for construction so that the url navigation is correct when clicking on a card and an undefined error when loading heater data

This commit is contained in:
csawatzky 2026-01-15 15:51:56 -06:00
parent d9bcd07c8d
commit 4342e1f27b
4 changed files with 7 additions and 12 deletions

2
package-lock.json generated
View file

@ -10953,7 +10953,7 @@
},
"node_modules/protobuf-ts": {
"version": "1.0.0",
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#c08965a296f2cd0799472fd8b163186cf6885d4c",
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#a646dbd472f266154f8c5f44146e0b27ccdda28f",
"dependencies": {
"protobufjs": "^6.8.8"
}

View file

@ -21,6 +21,7 @@ import { pond } from "protobuf-ts/pond";
import React, { useEffect, useState } from "react";
import { makeStyles } from "@mui/styles";
import { useGlobalState } from "providers";
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
interface TabPanelProps {
children?: React.ReactNode;
@ -116,13 +117,7 @@ export default function DeviceLinkDrawer(props: Props) {
undefined,
undefined,
undefined,
true,
undefined,
undefined,
undefined,
undefined,
undefined,
as
true
)
.then(resp => {
let devMap = new Map<string, pond.ComprehensiveDevice>();

View file

@ -109,7 +109,7 @@ export default function ObjectHeaterCard(props: Props) {
});
}
}
if (heaterData.devices[0]) {
if (heaterData.devices && heaterData.devices[0]) {
setConnectedDevice(Device.any(heaterData.devices[0].device));
heaterData.devices[0].components.forEach(c => {
//loop through the components and assign them accordingly
@ -171,7 +171,7 @@ export default function ObjectHeaterCard(props: Props) {
const goToHeater = () => {
//history.push("/objectHeaters/" + heater.key);
let path = "/objectHeaters/" + heater.key;
let path = "/heaters/" + heater.key;
navigate(path, { state: {heater: heater} });
};

View file

@ -56,8 +56,8 @@ export default function Site() {
siteAPI
.getSitePage(siteKey, as)
.then(resp => {
setSite(ISite.any(resp.data.site));
setHeaters(resp.data.heaterData);
if(resp.data.site) setSite(ISite.any(resp.data.site));
if(resp.data.heaterData) setHeaters(resp.data.heaterData);
setLoadingSite(false);
})
.catch(err => {