diff --git a/public/src/widgets.js b/public/src/widgets.js
index d16f0e27fd..00bad7ffe6 100644
--- a/public/src/widgets.js
+++ b/public/src/widgets.js
@@ -30,17 +30,6 @@
function renderWidgets(location) {
var area = $('#content [widget-area="' + location + '"]');
- if (!area.length && window.location.pathname.indexOf('/admin') === -1) {
- if (location === 'footer') {
- $('#content').append($('
'));
- } else if (location === 'sidebar') {
- $('#content > *').wrapAll($(''));
- $('#content').append($(''));
- }
-
- area = $('#content [widget-area="' + location + '"]');
- }
-
socket.emit('widgets.render', {template: tpl_url + '.tpl', url: url, location: location}, function(err, renderedWidgets) {
var html = '';
@@ -50,6 +39,17 @@
}
}
+ if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) {
+ if (location === 'footer') {
+ $('#content').append($(''));
+ } else if (location === 'sidebar') {
+ $('#content > *').wrapAll($(''));
+ $('#content').append($(''));
+ }
+
+ area = $('#content [widget-area="' + location + '"]');
+ }
+
area.html(html).removeClass('hidden');
if (!renderedWidgets.length) {