Skip to content

A platform for community discussion. Free, open, simple.

UX: avoid showing empty state before content loads on user activity pages (#36390)

Kris099edf9a96bd
diff --git a/frontend/discourse/app/components/post-list/index.gjs b/frontend/discourse/app/components/post-list/index.gjs
index b437e30d5d5..35f43e84c0a 100644
--- a/frontend/discourse/app/components/post-list/index.gjs
+++ b/frontend/discourse/app/components/post-list/index.gjs
@@ -50,6 +50,10 @@ export default class PostList extends Component {
@tracked canLoadMore = true;
@tracked emptyText = this.args.emptyText || i18n("post_list.empty");
+ get isLoadingContent() {
+ return this.loading || this.args.isLoading;
+ }
+
@action
async loadMore() {
if (
@@ -128,7 +132,9 @@ export default class PostList extends Component {
</:belowPostItem>
</PostListItem>
{{else}}
- <div class="post-list__empty-text">{{this.emptyText}}</div>
+ {{#unless this.isLoadingContent}}
+ <div class="post-list__empty-text">{{this.emptyText}}</div>
+ {{/unless}}
{{/each}}
</div>
<ConditionalLoadingSpinner @condition={{this.loading}} />
diff --git a/frontend/discourse/app/components/user-stream.gjs b/frontend/discourse/app/components/user-stream.gjs
index 50b64282c44..25972e5f6c7 100644
--- a/frontend/discourse/app/components/user-stream.gjs
+++ b/frontend/discourse/app/components/user-stream.gjs
@@ -183,6 +183,7 @@ export default class UserStreamComponent extends Component {
<template>
<PostList
@posts={{@stream.content}}
+ @isLoading={{@stream.loading}}
@idPath="post_id"
@urlPath="postUrl"
@usernamePath={{this.usernamePath}}
diff --git a/frontend/discourse/app/templates/user/stream.gjs b/frontend/discourse/app/templates/user/stream.gjs
index 293bd5d6fd5..9c7fe7e8a9c 100644
--- a/frontend/discourse/app/templates/user/stream.gjs
+++ b/frontend/discourse/app/templates/user/stream.gjs
@@ -3,10 +3,12 @@ import UserStream from "discourse/components/user-stream";
export default <template>
{{#if @controller.model.stream.noContent}}
- <EmptyState
- @title={{@controller.model.emptyState.title}}
- @body={{@controller.model.emptyState.body}}
- />
+ {{#unless @controller.model.stream.loading}}
+ <EmptyState
+ @title={{@controller.model.emptyState.title}}
+ @body={{@controller.model.emptyState.body}}
+ />
+ {{/unless}}
{{/if}}
<UserStream @stream={{@controller.model.stream}} />