Skip to content

Commit 6070c97

Browse files
authored
feat: apply feed v2 highlights by default (#6099)
1 parent e133152 commit 6070c97

4 files changed

Lines changed: 7 additions & 27 deletions

File tree

packages/shared/src/components/MainFeedLayout.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import {
2727
ANONYMOUS_FEED_QUERY,
2828
baseFeedSupportedTypes,
2929
CUSTOM_FEED_QUERY,
30+
feedV2SupportedTypes,
3031
FEED_BY_TAGS_QUERY,
3132
FEED_V2_QUERY,
3233
FOLLOWING_FEED_QUERY,
3334
MOST_DISCUSSED_FEED_QUERY,
3435
MOST_UPVOTED_FEED_QUERY,
3536
SEARCH_POSTS_QUERY,
36-
getFeedV2SupportedTypes,
3737
} from '../graphql/feed';
3838
import { generateQueryKey, OtherFeedPage, RequestKey } from '../lib/query';
3939
import SettingsContext from '../contexts/SettingsContext';
@@ -61,7 +61,6 @@ import {
6161
discussedFeedVersion,
6262
feature,
6363
featureFeedTagChips,
64-
featureFeedV2Highlights,
6564
followingFeedVersion,
6665
latestFeedVersion,
6766
popularFeedVersion,
@@ -322,16 +321,6 @@ export default function MainFeedLayout({
322321
feature: customFeedVersion,
323322
shouldEvaluate: feedName === SharedFeedPage.Custom,
324323
});
325-
const shouldEvaluateFeedV2Highlights =
326-
!!user &&
327-
((feedName === SharedFeedPage.MyFeed && !isCustomDefaultFeed) ||
328-
feedName === SharedFeedPage.Search ||
329-
(feedName === SharedFeedPage.CustomForm &&
330-
router.query?.slugOrId === user?.id));
331-
const { value: isFeedV2HighlightsEnabled } = useConditionalFeature({
332-
feature: featureFeedV2Highlights,
333-
shouldEvaluate: shouldEvaluateFeedV2Highlights,
334-
});
335324

336325
const isChipStripPage =
337326
router.pathname === '/' || router.pathname === '/explore/[tag]';
@@ -424,8 +413,7 @@ export default function MainFeedLayout({
424413
dynamicFeedConfig?.query || feedConfig.query,
425414
dynamicFeedConfig?.queryIfLogged || feedConfig.queryIfLogged || null,
426415
);
427-
const shouldRequestFeedV2Highlights =
428-
query === FEED_V2_QUERY && isFeedV2HighlightsEnabled;
416+
const shouldRequestFeedV2Highlights = query === FEED_V2_QUERY;
429417

430418
return {
431419
requestKey: feedConfig.requestKey,
@@ -435,7 +423,7 @@ export default function MainFeedLayout({
435423
...dynamicFeedConfig?.variables,
436424
...(shouldRequestFeedV2Highlights
437425
? {
438-
supportedTypes: getFeedV2SupportedTypes(true),
426+
supportedTypes: feedV2SupportedTypes,
439427
highlightsLimit: FEED_V2_HIGHLIGHTS_LIMIT,
440428
}
441429
: {}),
@@ -460,7 +448,6 @@ export default function MainFeedLayout({
460448
customFeedV,
461449
tokenRefreshed,
462450
feedVersion,
463-
isFeedV2HighlightsEnabled,
464451
]);
465452

466453
const [selectedAlgo, setSelectedAlgo, loadedAlgo] = usePersistentContext(

packages/shared/src/graphql/feed.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
baseFeedSupportedTypes,
44
FEED_V2_HIGHLIGHTS_LIMIT,
55
FEED_V2_QUERY,
6-
getFeedV2SupportedTypes,
6+
feedV2SupportedTypes,
77
normalizeFeedPage,
88
} from './feed';
99

@@ -20,9 +20,8 @@ describe('normalizeFeedPage', () => {
2020
expect(FEED_V2_HIGHLIGHTS_LIMIT).toBe(5);
2121
});
2222

23-
it('should add highlight to feedV2 supported types only when enabled', () => {
24-
expect(getFeedV2SupportedTypes(false)).toEqual(baseFeedSupportedTypes);
25-
expect(getFeedV2SupportedTypes(true)).toEqual([
23+
it('should always include highlight in feedV2 supported types', () => {
24+
expect(feedV2SupportedTypes).toEqual([
2625
...baseFeedSupportedTypes,
2726
'highlight',
2827
]);

packages/shared/src/graphql/feed.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ const joinedTypes = baseFeedSupportedTypes.join('","');
3636
export const SUPPORTED_TYPES = `$supportedTypes: [String!] = ["${joinedTypes}"]`;
3737
export const FEED_V2_HIGHLIGHTS_LIMIT = 5;
3838

39-
export const getFeedV2SupportedTypes = (
40-
shouldSupportHighlights: boolean,
41-
): string[] =>
42-
shouldSupportHighlights
43-
? [...baseFeedSupportedTypes, 'highlight']
44-
: [...baseFeedSupportedTypes];
39+
export const feedV2SupportedTypes = [...baseFeedSupportedTypes, 'highlight'];
4540

4641
export interface FeedData {
4742
page: Connection<Post>;

packages/shared/src/lib/featureManagement.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const upvotedFeedVersion = new Feature('upvoted_feed_version', 2);
3232
export const discussedFeedVersion = new Feature('discussed_feed_version', 2);
3333
export const latestFeedVersion = new Feature('latest_feed_version', 2);
3434
export const customFeedVersion = new Feature('custom_feed_version', 2);
35-
export const featureFeedV2Highlights = new Feature('feed_v2_highlights', false);
3635
export const featurePostPageHighlights = new Feature(
3736
'post_page_highlights',
3837
false,

0 commit comments

Comments
 (0)