FIX: wait for groups before showing empty message

FIX: wait for groups before showing empty message

diff --git a/app/assets/javascripts/discourse/app/templates/groups/index.hbs b/app/assets/javascripts/discourse/app/templates/groups/index.hbs
index ede51ea..5abcf07 100644
--- a/app/assets/javascripts/discourse/app/templates/groups/index.hbs
+++ b/app/assets/javascripts/discourse/app/templates/groups/index.hbs
@@ -30,8 +30,8 @@
     </div>
   </div>
 
-  {{#if groups}}
-    {{#conditional-loading-spinner condition=isLoading}}
+  {{#conditional-loading-spinner condition=isLoading}}
+    {{#if groups}}
       {{#load-more selector=".groups-boxes .group-box" action=(action "loadMore")}}
         <div class="container">
           <div class="groups-boxes">
@@ -42,16 +42,15 @@
                     {{#if group.flair_url}}
                       <span class="group-avatar-flair">
                         {{avatar-flair
-                          flairURL=group.flair_url
-                          flairBgColor=group.flair_bg_color
-                          flairColor=group.flair_color
-                          groupName=group.name}}
+                            flairURL=group.flair_url
+                            flairBgColor=group.flair_bg_color
+                            flairColor=group.flair_color
+                            groupName=group.name}}
                       </span>
                     {{/if}}
 
                     <span class="group-info">
                       {{groups-info group=group}}
-
                       <div class="group-user-count">{{d-icon "user"}}{{group.user_count}}</div>
                     </span>
                   </div>
@@ -95,8 +94,9 @@
       {{/load-more}}
 
       {{conditional-loading-spinner condition=groups.loadingMore}}
-    {{/conditional-loading-spinner}}
-  {{else}}
-    <p>{{i18n "groups.index.empty"}}</p>
-  {{/if}}
+    {{else}}
+      <p>{{i18n "groups.index.empty"}}</p>
+    {{/if}}
+  {{/conditional-loading-spinner}}
+
 {{/d-section}}

GitHub sha: ec0b4b2a

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/groups-index-page-shows-no-visible-groups-before-groups-are-loaded/162620/2