Skip to content

Commit a28f70e

Browse files
committed
Fix endless loop for misconfigured catalogUrls #580
1 parent a8ee79f commit a28f70e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/store/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,14 @@ function getStore(config, router) {
712712
await cx.dispatch('auth/requestLogin');
713713
},
714714
async load(cx, args) {
715-
let { url, show, force, noRetry, omitApi } = args;
715+
let {
716+
url, // URL to load
717+
show, // Show the page when loading is finished, otherwise it's likely loaded in the background for completing specific parts of the page
718+
force, // Force reloading the data, omit the cache
719+
noRetry, // Don't retry on authentication errors
720+
omitApi, // Don't load API collections or API items yet
721+
isRoot // Is a request for the root catalog initiated by this function, avoiding endless loops in some mis-configured instances (see https://github.com/radiantearth/stac-browser/issues/580)
722+
} = args;
716723

717724
const path = cx.getters.toBrowserPath(url);
718725
url = Utils.toAbsolute(url, cx.state.url);
@@ -801,7 +808,7 @@ function getStore(config, router) {
801808
}
802809

803810
// Load the root catalog data if not available (e.g. after page refresh or external access)
804-
if (!cx.getters.root) {
811+
if (!cx.getters.root && !isRoot) {
805812
let catalogUrl = cx.state.catalogUrl;
806813
if (!catalogUrl) {
807814
const root = data.getLinkWithRel('root');
@@ -811,7 +818,7 @@ function getStore(config, router) {
811818
}
812819
}
813820
if (catalogUrl) {
814-
await cx.dispatch("load", { url: catalogUrl, omitApi: true });
821+
await cx.dispatch("load", { url: catalogUrl, omitApi: true, isRoot: true });
815822
}
816823
}
817824

0 commit comments

Comments
 (0)