From c61f764c169643b5b0e6faf60d01a976bc7be77a Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 25 May 2021 15:58:52 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=94=A7=20Memoize=20mapArea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/hooks/useMapAreaState.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nest_frontend/hooks/useMapAreaState.js b/nest_frontend/hooks/useMapAreaState.js index f1b8354..75a94c6 100644 --- a/nest_frontend/hooks/useMapAreaState.js +++ b/nest_frontend/hooks/useMapAreaState.js @@ -1,4 +1,4 @@ -import { useState } from "react" +import { useMemo, useState } from "react" import Coordinates from "../objects/Coordinates" import MapArea from "../objects/MapArea" @@ -9,7 +9,10 @@ import MapArea from "../objects/MapArea" export default function useMapAreaState() { const [zoom, setZoom] = useState(3) const [center, setCenter] = useState(new Coordinates(0, 0)) - const mapArea = MapArea.fromZoomLevel(zoom, center) + const mapArea = useMemo( + () => MapArea.fromZoomLevel(zoom, center), + [zoom, center] + ) return { zoom, From a9ae5fbceef764eb52da06a6566b9029fc17eaca Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 25 May 2021 15:59:09 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20Fix=20ConditionLocations=20f?= =?UTF-8?q?ailing=20comparisions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/objects/Coordinates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nest_frontend/objects/Coordinates.js b/nest_frontend/objects/Coordinates.js index e6b2ab0..060d5a7 100644 --- a/nest_frontend/objects/Coordinates.js +++ b/nest_frontend/objects/Coordinates.js @@ -40,7 +40,7 @@ export default class Coordinates { * @returns {string} */ toString() { - return `${this.lat.toFixed(7)} ${this.lng.toFixed(7)}` + return `${this.lat} ${this.lng}` } /** From b9422ac85f0e7ae1863434ada362dfc409023384 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 25 May 2021 16:03:19 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20useless=20debug=20s?= =?UTF-8?q?tatement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/objects/Condition.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/nest_frontend/objects/Condition.js b/nest_frontend/objects/Condition.js index a0d972f..4bae4bf 100644 --- a/nest_frontend/objects/Condition.js +++ b/nest_frontend/objects/Condition.js @@ -27,8 +27,6 @@ export class Condition { } static fromRaw(data) { - console.debug("Trying to serialize condition: ", data) - if(data.type === 0) return ConditionHashtag.fromRaw(data) else if(data.type === 2) return ConditionTime.fromRaw(data) else if(data.type === 3) return ConditionLocation.fromRaw(data)