Skip to content

Commit b8be1ac

Browse files
committed
feat(headlines-feed): enhance user content preferences fetching
- Add `userId` parameter to `read` method in demo environment - Improve scoping of user-specific data in DataInMemory - Maintain backward compatibility for development/production environments
1 parent 28aa92a commit b8be1ac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/headlines-feed/bloc/headlines_feed_bloc.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,13 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
349349

350350
// Fetch user content preferences to get followed items for filtering suggestions.
351351
final userPreferences = currentUser?.id != null
352-
? await _userContentPreferencesRepository.read(id: currentUser!.id)
352+
? await _userContentPreferencesRepository.read(
353+
id: currentUser!.id,
354+
// In the demo environment, `DataInMemory` requires `userId` for correct
355+
// scoping of user-specific data. In development/production, the backend
356+
// handles this scoping, making `userId` optional at the client level.
357+
userId: currentUser.id,
358+
)
353359
: null;
354360

355361
// Use the full decoration pipeline, which includes injecting a

0 commit comments

Comments
 (0)