Remove Timeout.

This commit is contained in:
Andrés Uribe Stengel 2020-07-16 15:19:01 +02:00
parent 76eb9012fa
commit 620018c501

View File

@ -3,8 +3,7 @@ import {CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XA
import SensorCardDeck from './SensorCardDeck'
import {SensorDataCollection, ActiveDeviceCollection} from "../../client/main";
import {useTracker} from 'meteor/react-meteor-data';
import {Col, Form, Row} from "react-bootstrap";
import {Col, Form, Row, Card, CardDeck} from "react-bootstrap";
export default function Home() {
@ -19,10 +18,14 @@ export default function Home() {
});
const sensorData = useTracker(() => {
return SensorDataCollection.find({device_id: deviceName.deviceName}, {
sort: {timestamp: -1},
limit: 61
}).fetch().reverse();
if (deviceName === null || deviceName === undefined) {
return [];
} else {
return SensorDataCollection.find({device_id: deviceName.deviceName}, {
sort: {timestamp: -1},
limit: 61
}).fetch().reverse();
}
});
const handleChange = (e) => {
@ -35,7 +38,7 @@ export default function Home() {
}
if ((sensorData.length <= 0) || (deviceName.length <= 0) || (uniqueEspNames.length <= 0)) {
if ((sensorData.length <= 0) || (deviceName.length <= 0)) {
return (
<CardDeck>
<Card>