Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,13 @@ const highlight = false;

var refs = {};
var get_ref = function(uri) {
return new Promise( resolve => {
return new Promise( (resolve, reject) => {
get_document( uri.clone().hash('').toString() ).then(function(schema){
refs[uri.toString()] = uri.hash() ? jsonpointer.get( schema, uri.hash() ) : schema;
}).then(function(){
debug('get_ref');
resolve();
});
}, reject);
});
};

Expand Down Expand Up @@ -543,11 +543,15 @@ const highlight = false;
// use the normalized uri
parentObject.update( uri.toString() );

debug(get_ref(uri));
get_ref( uri ).finally( () => {
var refp = get_ref(uri);
debug(refp);
refp.finally( () => {
throttled_render();
resolve();
});
})
// avoid "unhandled rejection" error - the output may be redundant as the
// browser probably already logged the failure, but better be explicit
.catch(e => { console.warn("Unable to resolve $ref " + uri.toString() + ":", e); });
});
}

Expand Down