Skip to content

Commit e6a55d1

Browse files
committed
fix(app_configuration): ensure remote config map is updated for feed decorators
- Modify the remoteConfig object to include a new FeedDecoratorConfig for the current decoratorType if it's not already present - This ensures that the map is always updated, preventing potential issues with missing decorator configurations
1 parent 5106cf1 commit e6a55d1

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

lib/app_configuration/view/app_configuration_page.dart

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,29 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
390390
children: [
391391
_FeedDecoratorForm(
392392
decoratorType: decoratorType,
393-
remoteConfig: remoteConfig,
393+
remoteConfig: remoteConfig.copyWith(
394+
feedDecoratorConfig: Map.from(remoteConfig.feedDecoratorConfig)
395+
..putIfAbsent(
396+
decoratorType,
397+
() => FeedDecoratorConfig(
398+
category: decoratorType == FeedDecoratorType.suggestedTopics ||
399+
decoratorType == FeedDecoratorType.suggestedSources
400+
? FeedDecoratorCategory.contentCollection
401+
: FeedDecoratorCategory.callToAction,
402+
enabled: false,
403+
visibleTo: const {},
404+
itemsToDisplay:
405+
decoratorType == FeedDecoratorType.suggestedTopics ||
406+
decoratorType == FeedDecoratorType.suggestedSources
407+
? 0
408+
: null,
409+
),
410+
),
411+
),
394412
onConfigChanged: (newConfig) {
395413
context.read<AppConfigurationBloc>().add(
396-
AppConfigurationFieldChanged(remoteConfig: newConfig),
397-
);
414+
AppConfigurationFieldChanged(remoteConfig: newConfig),
415+
);
398416
},
399417
buildIntField: _buildIntField,
400418
),

0 commit comments

Comments
 (0)