Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fetch nodes from cache when selecting ways #265

Merged
merged 2 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion app/actions/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const REQUESTED_TILE = 'REQUESTED_TILE'
export const SET_SELECTED_FEATURE = 'SET_SELECTED_FEATURE'
export const SET_SELECTED_FEATURES = 'SET_SELECTED_FEATURES'
export const SET_SELECTED_PHOTOS = 'SET_SELECTED_PHOTOS'
export const SET_SELECTED_WAY = 'SET_SELECTED_WAY'

export const START_ADD_POINT = 'START_ADD_POINT'
export const ADD_FEATURE = 'ADD_FEATURE'
Expand Down
20 changes: 0 additions & 20 deletions app/actions/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { saveDataForTile } from '../services/osm-api'
import { addNodes, clearNodeCacheForTile, purgeNodeCache } from '../services/nodecache'
import { bboxToTiles } from '../utils/bbox'
import cache from '../utils/data-cache'
import { nodesGeojson } from '../utils/nodes-to-geojson'

const queue = new PQueue({
concurrency: 4
Expand Down Expand Up @@ -700,25 +699,6 @@ export function setSelectedFeatures (features) {
type: types.SET_SELECTED_FEATURES,
features: features
})
if (features.length) {
features.forEach(async f => {
if (f.geometry.type !== 'Point') {
const nodeIds = f.properties.ndrefs.map(n => {
return `node/${n}`
})
const geojson = await nodesGeojson(nodeIds)
dispatch({
type: types.SET_SELECTED_WAY,
geojson: geojson
})
}
})
} else {
dispatch({
type: types.SET_SELECTED_WAY,
geojson: null
})
}
}
}

Expand Down
7 changes: 0 additions & 7 deletions app/reducers/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,6 @@ export default function (state = initialState, action) {
selectedFeatures: features
}

case types.SET_SELECTED_WAY:
let geojson = action.geojson
return {
...state,
selectedFeaturesMemberNodes: geojson
}

case types.START_ADD_POINT:
return {
...state,
Expand Down
5 changes: 0 additions & 5 deletions app/screens/Explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ class Explore extends React.Component {
style,
photosGeojson,
selectedPhotos,
selectedFeaturesMemberNodes,
editingWayMemberNodes,
currentWayEdit,
selectedNode,
Expand Down Expand Up @@ -808,9 +807,6 @@ class Explore extends React.Component {
<MapboxGL.ShapeSource id='currentWayEdit' shape={currentWayEdit}>
<MapboxGL.LineLayer id='currentWayLine' style={style.osm.editingWay.lines} minZoomLevel={16} />
</MapboxGL.ShapeSource>
<MapboxGL.ShapeSource id='selectedFeaturesMemberNodesSource' shape={selectedFeaturesMemberNodes}>
<MapboxGL.CircleLayer id='selectedFeaturesMemberNodes' style={style.osm.selectedFeatures.nodes} minZoomLevel={16} />
</MapboxGL.ShapeSource>
<MapboxGL.ShapeSource id='nearestFeatures' shape={nearestFeatures}>
<MapboxGL.LineLayer id='nearestEdges' style={style.osm.editingWay.nearestFeatures.lines} minZoomLevel={16} />
<MapboxGL.CircleLayer id='nearestNodes' minZoomLevel={16} style={style.osm.editingWay.nearestFeatures.nodes} />
Expand Down Expand Up @@ -887,7 +883,6 @@ const mapStateToProps = (state) => {
currentTraceStatus: getCurrentTraceStatus(state),
isConnected: state.network.isConnected,
selectedFeatures: state.map.selectedFeatures || false,
selectedFeaturesMemberNodes: state.map.selectedFeaturesMemberNodes || featureCollection([]),
editingWayMemberNodes,
mode: state.map.mode,
edits: state.edit.edits,
Expand Down