File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,17 +251,24 @@ export default function DashboardLayoutBasic() {
251251 return ;
252252 }
253253
254- const dz = findClosestDropzone ( [ target . target . lng , target . target . lat ] ) ;
254+ const targetPoint = [ target . target . lng , target . target . lat ] ;
255+ let dz = findClosestDropzone ( targetPoint ) ;
256+ const distanceToDz = turf . distance ( targetPoint , [ dz . lng , dz . lat ] , { units : 'feet' } ) ;
257+
258+ if ( distanceToDz > 5000 ) {
259+ dz = null ;
260+ }
261+
255262 const { forecastSource } = settings ;
256263
257264 console . log (
258265 `Fetching winds using ${ forecastSource } for: ${ JSON . stringify ( target . target ) } ,`
259- + ` useDzGroundWind=${ settings . useDzGroundWind } (dz=${ dz . name } )`
266+ + ` useDzGroundWind=${ settings . useDzGroundWind } (dz=${ dz ? .name } )`
260267 ) ;
261268
262269 setFetching ( true ) ;
263270
264- fetchForecast ( forecastSource , target . target , settings . useDzGroundWind && dz . fetchGroundWind )
271+ fetchForecast ( forecastSource , target . target , settings . useDzGroundWind && dz ? .fetchGroundWind )
265272 . then ( fetchedWinds => {
266273 let limit = settings . limitWind ;
267274
You can’t perform that action at this time.
0 commit comments