@@ -100,6 +100,7 @@ export default function TarmoMap({ setPopupInfo }: TarmoMapProps): JSX.Element {
100
100
LayerId . DigiTransitPoint ,
101
101
{
102
102
url : "https://api.digitransit.fi/routing/v1/routers/waltti/index/graphql" ,
103
+ tarmo_category : "Pysäkit" ,
103
104
zoomThreshold : 12 ,
104
105
reload : true ,
105
106
gqlQuery : `{
@@ -123,6 +124,7 @@ export default function TarmoMap({ setPopupInfo }: TarmoMapProps): JSX.Element {
123
124
LayerId . DigiTransitBikePoint ,
124
125
{
125
126
url : "https://api.digitransit.fi/routing/v1/routers/waltti/index/graphql" ,
127
+ tarmo_category : "Pysäkit" ,
126
128
zoomThreshold : 12 ,
127
129
reload : false ,
128
130
gqlQuery : `{
@@ -157,6 +159,12 @@ export default function TarmoMap({ setPopupInfo }: TarmoMapProps): JSX.Element {
157
159
"User-Agent" : "TARMO - Tampere Mobilemap" ,
158
160
} ;
159
161
externalSources . forEach ( ( value , key ) => {
162
+ // Do not reload if data is not visible
163
+ if (
164
+ mapFiltersContext . getVisibilityValue ( value . tarmo_category ) == "none"
165
+ ) {
166
+ return ;
167
+ }
160
168
// Do not reload if data does not need to be updated
161
169
if ( ! value . reload && externalData && externalData . get ( key ) ) {
162
170
return ;
@@ -192,7 +200,7 @@ export default function TarmoMap({ setPopupInfo }: TarmoMapProps): JSX.Element {
192
200
useEffect ( ( ) => {
193
201
loadExternalData ( ) ;
194
202
// eslint-disable-next-line
195
- } , [ bounds ] ) ;
203
+ } , [ bounds , mapFiltersContext ] ) ;
196
204
197
205
// TODO: at the moment, the user can only select points on the search layer.
198
206
// Another way of implementing this would be to zoom in when selected, and
0 commit comments