Skip to content

[FSSDK-11497] fire config update events synchronously #1043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025

Conversation

raju-opti
Copy link
Contributor

@raju-opti raju-opti commented May 6, 2025

Summary

  • fire the project config updates synchronously. this will allow the optimizely class to propagate the initial project config synchronously to all sub components. This can be useful when the client is initialized with a datafile. One downside is, the update event handler needs to be registered before calling start() on the config manager, but since we only use the config manager internally, we can maintain that.

Issues

  • FSSDK-11497

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the project's configuration update flow to fire events synchronously, ensuring the initial configuration is propagated immediately.

  • Removed the asynchronous scheduleMicrotask wrapping for update events in the ProjectConfigManager.
  • Updated tests to reflect the new synchronous behavior and adjust the timing of manager.start() calls accordingly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/project_config/project_config_manager.ts Removed scheduleMicrotask to emit update events synchronously.
lib/project_config/project_config_manager.spec.ts Adjusted tests to register listeners before start() and reflect synchronous updates.
Comments suppressed due to low confidence (1)

lib/project_config/project_config_manager.ts:167

  • Switching to synchronous event emission may block the caller if listeners perform heavy work. Ensure that all update listeners are lightweight or document the synchronous behavior clearly.
scheduleMicrotask(() => {

@coveralls
Copy link

coveralls commented May 6, 2025

Coverage Status

coverage: 80.73% (+0.005%) from 80.725%
when pulling 903ca5d on raju/sync_update_config
into 299e1d7 on master.

@raju-opti raju-opti force-pushed the raju/sync_update_config branch from 0410b2b to 903ca5d Compare May 6, 2025 19:48
@raju-opti raju-opti changed the title fire config update events synchronously [FSSDK-11497] fire config update events synchronously May 6, 2025
@raju-opti raju-opti merged commit 379ebd0 into master May 6, 2025
17 of 19 checks passed
@raju-opti raju-opti deleted the raju/sync_update_config branch May 6, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants