Skip to content

Commit 4d7eb21

Browse files
authored
Clear feed when filters return no results (#2540)
1 parent 5c74d87 commit 4d7eb21

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

build/social-web/feed-stage.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/social-web/routes/feed/stage.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ export default function FeedStage( { onSelectItem }: FeedStageProps ) {
214214
const currentPage = normalizedView.page || 1;
215215
const infiniteScrollEnabled = normalizedView.infiniteScrollEnabled;
216216

217+
// Clear records when on first page with no results (handles filter/search changes)
218+
if ( feed.length === 0 && currentPage === 1 ) {
219+
setAllLoadedRecords( [] );
220+
lastProcessedPage.current = currentPage;
221+
setIsLoadingMore( false );
222+
return;
223+
}
224+
217225
// Don't process until feed data is available
218226
if ( feed.length === 0 ) {
219227
return;
@@ -266,7 +274,7 @@ export default function FeedStage( { onSelectItem }: FeedStageProps ) {
266274
onChangeSelection={ changeSelection }
267275
empty={
268276
<p>
269-
{ normalizedView.search
277+
{ normalizedView.search || ( normalizedView.filters && normalizedView.filters.length > 0 )
270278
? __( 'No posts found.', 'activitypub' )
271279
: __(
272280
'No posts found in your feed. Posts from ActivityPub actors you follow will appear here.',

0 commit comments

Comments
 (0)