Skip to content

Commit

Permalink
Allow inline root sequence data
Browse files Browse the repository at this point in the history
Auspice does not attempt to fetch any sidecar file until the main JSON
has been fetched, so it makes sense to avoid attempting to fetch the
root-sequence JSON when it is present in the main dataset JSON.
  • Loading branch information
jameshadfield committed Aug 29, 2023
1 parent 1bbed4c commit 7204eed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/actions/loadData.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Dataset.prototype.fetchSidecars = async function fetchSidecars() {
.catch((reason) => Promise.resolve(reason))
}

if (!this.rootSequence) {
if (!mainJson.root_sequence && !this.rootSequence) {
// Note that the browser may log a GET error if the above 404s
this.rootSequence = fetchJSON(this.apiCalls.rootSequence)
.catch((reason) => Promise.resolve(reason))
Expand Down
5 changes: 5 additions & 0 deletions src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ const createMetadataStateFromJSON = (json) => {
if (json.meta.panels) {
metadata.panels = json.meta.panels;
}
if (json.root_sequence) {
/* A dataset may set the root sequence inline (i.e. within the main dataset JSON), which
we capture here. Alternatively it may be a sidecar JSON file */
metadata.rootSequence = json.root_sequence;
}
if (json.meta.display_defaults) {
metadata.displayDefaults = {};
const jsonKeyToAuspiceKey = {
Expand Down

0 comments on commit 7204eed

Please sign in to comment.