Skip to content

Commit

Permalink
fix issue when queryables is not supported by STAC API server
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Varner committed May 7, 2024
1 parent bf765ac commit 1109917
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## unreleased

### Fixed

- UI no longer throws an error if the STAC API does not support a queryables endpoint.

## 5.1.0 - 2024-04-10

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/components/CloudSlider/CloudSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const CloudSlider = () => {
useEffect(() => {
if (_selectedCollectionData) {
const supportsCloudCover =
_selectedCollectionData.queryables['eo:cloud_cover']
_selectedCollectionData.queryables?.['eo:cloud_cover']
if (supportsCloudCover) {
setDisabled(!supportsCloudCover)
dispatch(setShowCloudSlider(true))
Expand Down
8 changes: 4 additions & 4 deletions src/utils/searchHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ function buildSearchScenesParams(gridCodeToSearchIn) {
}

const query = {}
if (_selectedCollection.queryables['eo:cloud_cover']) {
if (_selectedCollection.queryables?.['eo:cloud_cover']) {
query['eo:cloud_cover'] = {
gte: 0,
lte: store.getState().mainSlice.cloudCover
}
}
if (_selectedCollection.queryables['sar:polarizations']) {
if (_selectedCollection.queryables?.['sar:polarizations']) {
query['sar:polarizations'] = { in: ['VV', 'VH'] }
}
if (gridCodeToSearchIn) {
Expand Down Expand Up @@ -208,13 +208,13 @@ function buildSearchAggregateParams(gridType) {
}

const query = {}
if (_selectedCollection.queryables['eo:cloud_cover']) {
if (_selectedCollection.queryables?.['eo:cloud_cover']) {
query['eo:cloud_cover'] = {
gte: 0,
lte: store.getState().mainSlice.cloudCover
}
}
if (_selectedCollection.queryables['sar:polarizations']) {
if (_selectedCollection.queryables?.['sar:polarizations']) {
query['sar:polarizations'] = { in: ['VV', 'VH'] }
}

Expand Down

0 comments on commit 1109917

Please sign in to comment.