From c12c9457843e0c74257b4b42a919a014898e452e Mon Sep 17 00:00:00 2001 From: Mark Biek Date: Wed, 18 Oct 2023 14:15:17 -0400 Subject: [PATCH] Specify correct orderBy parameter for the Recommended tab (#83185) The "Recommended" tab should show posts ordered by popularity. Previously, we ordered "Recommended" by date so it showed the same posts as "Latest". --- client/state/data-layer/wpcom/read/streams/index.js | 2 ++ client/state/data-layer/wpcom/read/streams/test/index.js | 1 + 2 files changed, 3 insertions(+) diff --git a/client/state/data-layer/wpcom/read/streams/index.js b/client/state/data-layer/wpcom/read/streams/index.js index c466332b515df..e88036e956ef3 100644 --- a/client/state/data-layer/wpcom/read/streams/index.js +++ b/client/state/data-layer/wpcom/read/streams/index.js @@ -229,6 +229,8 @@ const streamApis = { tag_recs_per_card: 5, site_recs_per_card: 5, age_based_decay: 0.5, + // Default order is by date (latest) unless we're on the recommended tab which shows popular instead. + orderBy: streamKeySuffix( streamKey ).includes( 'recommended' ) ? 'popular' : 'date', } ), apiNamespace: 'wpcom/v2', }, diff --git a/client/state/data-layer/wpcom/read/streams/test/index.js b/client/state/data-layer/wpcom/read/streams/test/index.js index 4457caad874f0..760e3466159fe 100644 --- a/client/state/data-layer/wpcom/read/streams/test/index.js +++ b/client/state/data-layer/wpcom/read/streams/test/index.js @@ -86,6 +86,7 @@ describe( 'streams', () => { site_recs_per_card: 5, tags: [], age_based_decay: 0.5, + orderBy: 'popular', }, }, },