@@ -604,6 +604,11 @@ function getStore(config, router) {
604
604
stac . setApiData ( collections , nextLink ) ;
605
605
}
606
606
} ,
607
+ resetApiCollections ( state ) {
608
+ state . apiCollections = [ ] ;
609
+ state . apiItemsLoading = { } ;
610
+ state . nextCollectionsLink = null ;
611
+ } ,
607
612
resetApiItems ( state , link ) {
608
613
state . apiItems = [ ] ;
609
614
state . apiItemsLink = link ;
@@ -911,16 +916,14 @@ function getStore(config, router) {
911
916
async loadNextApiCollections ( cx , args ) {
912
917
let { stac, show, noRetry } = args ;
913
918
let link ;
914
- if ( stac ) {
915
- // First page
916
- if ( cx . state . apiCollections . length > 0 ) {
917
- // If we have already loaded collections, skip loading the first page
918
- return ;
919
- }
919
+ if ( stac ) { // First page
920
+ // If we load from new collections, reset list of collections.
921
+ // Otherwise we may append to collections from a parent entity.
922
+ // https://github.com/radiantearth/stac-browser/issues/617
923
+ cx . commit ( 'resetApiCollections' ) ;
920
924
link = stac . getLinkWithRel ( 'data' ) ;
921
925
}
922
- else {
923
- // Second page and after
926
+ else { // Second page and after
924
927
stac = cx . state . data ;
925
928
link = cx . state . nextCollectionsLink ;
926
929
}
0 commit comments