oc
oc copied to clipboard
Handling failed render in oc-client
So there is pretty much no way to tell that component failed to render for some reason, outside of error in console, but thats not really helpful.
The whole solution will be something like
// oc-client.js:382
oc.renderByHref($component.attr('href'), function(err, data){
if(err || !data){
- $component.html('');
+ $component
+ .attr('data-rendering', 'false')
+ .attr('data-rendered', 'false')
+ .html('');
+ oc.events.fire('oc:failed', { originalError: err, data: data });
logger.error(err);
return callback();
}
processHtml($component, data, callback);
});
@zoilorys sorry for the huge delay on answering to this. I think your idea of firing a new event with the details is very good. Would you be able to attempt a PR with this? Thanks!
@zoilorys I like the idea.
FYI: we recently moved the oc-client-browser
code in its own repo -> https://github.com/opencomponents/oc-client-browser/ would you like to attempt a PR there? Happy to help if you need anything to make this happen!