fix plant selection bugs
This commit is contained in:
parent
c532f1426a
commit
d6b0a7d396
|
@ -2,7 +2,7 @@ import * as React from "react";
|
|||
import { t } from "i18next";
|
||||
import { error } from "farmbot-toastr";
|
||||
import { Plant, DEFAULT_PLANT_RADIUS } from "../plant";
|
||||
import { movePlant, closePlantInfo } from "../actions";
|
||||
import { movePlant, closePlantInfo, unselectPlant } from "../actions";
|
||||
import * as moment from "moment";
|
||||
import { GardenMapProps, GardenMapState } from "../interfaces";
|
||||
import { getPathArray } from "../../history";
|
||||
|
@ -65,6 +65,10 @@ export class GardenMap extends
|
|||
this.state = {};
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
unselectPlant(this.props.dispatch)();
|
||||
}
|
||||
|
||||
get isEditing(): boolean { return getMode() === Mode.editPlant; }
|
||||
|
||||
endDrag = () => {
|
||||
|
|
|
@ -54,10 +54,10 @@ export class SelectPlants
|
|||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.dispatch({ type: Actions.SELECT_PLANT, payload: undefined });
|
||||
this.unstashSelectedPlant();
|
||||
}
|
||||
|
||||
onBack = () => {
|
||||
unstashSelectedPlant = () => {
|
||||
const { stashedUuid, stashedIcon } = this.state;
|
||||
this.props.dispatch({ type: Actions.SELECT_PLANT, payload: [stashedUuid] });
|
||||
this.props.dispatch({
|
||||
|
@ -88,7 +88,7 @@ export class SelectPlants
|
|||
className="panel-container green-panel plant-selection-panel">
|
||||
<div className="panel-header green-panel">
|
||||
<p className="panel-title">
|
||||
<BackArrow onClick={this.onBack} />
|
||||
<BackArrow onClick={this.unstashSelectedPlant} />
|
||||
{t("Select plants")}
|
||||
</p>
|
||||
|
||||
|
|
Loading…
Reference in a new issue