Skip to content

Commit

Permalink
Potentially fix for loading collection for search inconsistently #479 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Oct 16, 2024
1 parent cce41cf commit 4bf054c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/components/StacHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ export default {
if (!this.canSearch) {
return null;
}
let dataLink;
let searchLink;
if (this.data instanceof STAC && !this.data.equals(this.root)) {
dataLink = this.data.getSearchLink();
searchLink = this.data.getSearchLink();
}
if (dataLink) {
if (searchLink) {
return `/search${this.data.getBrowserPath()}`;
}
else if (this.root && this.allowSelectCatalog) {
Expand Down
6 changes: 0 additions & 6 deletions src/views/BrowseMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ export default {
}
return null;
},
created() {
// Load the root catalog data if not available (e.g. after page refresh or external access)
if (this.catalogUrl) {
this.$store.dispatch("load", { url: this.catalogUrl, loadApi: true });
}
},
errorDescription() {
if (this.error instanceof Error && this.error.isAxiosError && Utils.isObject(this.error.response)) {
let res = this.error.response;
Expand Down
8 changes: 4 additions & 4 deletions src/views/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ export default {
return this.isCollectionSearch ? this.collectionSearch : this.itemSearch;
},
collectionSearch() {
return this.canSearchCollections && this.parent instanceof STAC && this.parent.getApiCollectionsLink();
return this.canSearchCollections && this.stac && this.stac.getApiCollectionsLink();
},
itemSearch() {
return this.canSearchItems && this.parent instanceof STAC && this.parent.getSearchLink();
return this.canSearchItems && this.stac && this.stac.getSearchLink();
},
itemCollection() {
if (this.isCollectionSearch) {
Expand Down Expand Up @@ -191,7 +191,7 @@ export default {
// so we check whether our current link has a next rel type which indicates
// that it's a subsequent page. On the first pages the link rel type would be
// "search" (or "prev" or "first"). This only works for forward navigation.
return this.link.rel === 'next';
return this.link && this.link.rel === 'next';
}
},
watch:{
Expand All @@ -217,7 +217,7 @@ export default {
this.parent = this.root;
}
if (!this.parent) {
await this.$store.dispatch('load', { url });
await this.$store.dispatch('load', { url, loadApi: true });
if (!this.root) {
await this.$store.dispatch("config", { catalogUrl: url });
}
Expand Down

0 comments on commit 4bf054c

Please sign in to comment.