Skip to content

Commit

Permalink
Merge pull request #127 from RENCI/125-map-refreshing-when-switching-…
Browse files Browse the repository at this point in the history
…tabs

bugfix: map refetching data on window/tab focus
  • Loading branch information
PhillipsOwen authored Jul 24, 2024
2 parents e9a1d47 + 5d6ee5f commit 950e3e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/components/map/default-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ export const DefaultLayers = () => {
}
return(data);
};
useQuery( {queryKey: ['apsviz-default-data', data_url], queryFn: getDefaultLayers, enable: !!data_url});
useQuery({
queryKey: ['apsviz-default-data', data_url],
queryFn: getDefaultLayers,
enable: !!data_url,
refetchOnWindowFocus: false,
});

// maybe should convert this one to use useQuery - not sure how to do that yet
useEffect(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/trays/model-selection/synopticTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export const SynopticTabForm = () => {

// return something
return true;
}
},

refetchOnWindowFocus: false
});

/**
Expand Down
5 changes: 4 additions & 1 deletion src/components/trays/model-selection/tropicalTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export const TropicalTabForm = () => {

// return something
return true;
}
},

refetchOnWindowFocus: false

});

/**
Expand Down

0 comments on commit 950e3e0

Please sign in to comment.