Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions map-view/src/components/FeatureInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ interface FeatureInfoProps extends WithStyles<typeof styles>, WithTranslation {
interface FeatureInfoState {
featureIndex: number;
realPlanDistance?: number;
features: Feature[];
}

class FeatureInfo extends React.Component<FeatureInfoProps, FeatureInfoState> {
Expand All @@ -52,9 +53,17 @@ class FeatureInfo extends React.Component<FeatureInfoProps, FeatureInfoState> {
this.state = {
featureIndex: 0,
realPlanDistance: undefined,
features: props.features,
};
}

static getDerivedStateFromProps(props: FeatureInfoProps, state: FeatureInfoState) {
if (props.features !== state.features) {
return { featureIndex: 0, realPlanDistance: undefined, features: props.features };
}
return null;
}

getAdminLink(feature: Feature) {
const app_name = feature["app_name"];
const fid = feature["id_"];
Expand All @@ -78,6 +87,7 @@ class FeatureInfo extends React.Component<FeatureInfoProps, FeatureInfoState> {
const { features, classes, onClose, t } = this.props;
const { featureIndex } = this.state;
const feature = features[featureIndex];

const fid = feature["id_"];
const featureType = fid.split(".")[0];
const {
Expand Down
Loading