Skip to content

Conversation

@luishcastroc
Copy link

@luishcastroc luishcastroc commented Oct 30, 2025

Angular SDK plugin

What did you accomplish?

Provider Pattern API (New Feature)

  • Add provideSplitIo() function with withConfig() and withFeatureOptions() for Angular standalone API
  • Add SplitIoService with automatic initialization and dependency injection
  • Add functional guards: splitIoReadyGuard, splitIoReadyMatchGuard, createTreatmentGuard(), createMultiTreatmentGuard()
  • Remove redundant splitIoReadyChildGuard (use splitIoReadyGuard for both canActivate and canActivateChild)

Signal Support (New Feature)

  • Add signal-based reactive state management alongside Observables for Angular 16+ compatibility
  • Add isReadySignal, isReadyFromCacheSignal, isTimedOutSignal, and hasUpdateSignal properties
  • Signals synchronized with existing Observable state for dual API support
  • Enable use with computed() and effect() for reactive programming patterns
  • Maintain backward compatibility with Observable-based patterns

Test Modernization

  • Convert all 22 tests from done() callbacks to async/await with firstValueFrom
  • Add 9 comprehensive tests for signal functionality
  • Eliminate nested subscription anti-patterns in complex Observable tests
  • Fix test patterns for multiple Observable emissions using proper async/await sequencing

Type Safety Improvements

  • Improve guard typing: use SplitIO.Treatment instead of generic string
  • Use SplitIO.Attributes instead of any for attributes parameter
  • Better type safety across guard functions

Documentation Updates

  • Add comprehensive signal examples to README.md with computed() and effect() usage
  • Add signal migration guide section to MIGRATION.md
  • Standardize terminology to "Provider Pattern" throughout documentation
  • Update CONTRIBUTORS-GUIDE.md to reflect main branch workflow (removed outdated development references)

How do we test the changes introduced in this PR?

npm test

All 81 tests passing with 90.2% line coverage, 84.88% branch coverage maintained.

Key test scenarios:

  • Provider pattern initialization with provideSplitIo()
  • Functional guards with async/await patterns
  • Service methods: getTreatment(), createClient(), track(), etc.
  • SDK event handling (ready, timeout, update events)
  • Multi-client support with shared keys
  • Error handling for uninitialized clients
  • Signal state synchronization with Observables
  • Signal readonly properties and reactive contexts

Extra Notes

  • This maintains backward compatibility - the legacy SplitService and SplitioGuard are still available but marked as deprecated
  • The new Provider Pattern follows Angular 14+ standalone API conventions
  • Signal support provides a path forward for Angular 16+ applications while keeping Observable support for existing codebases
  • All async test patterns now use async/await instead of callbacks, making tests easier to read and maintain
  • Type safety improvements help catch errors at compile time rather than runtime
  • Signals offer better performance for synchronous state updates and simpler syntax with computed values

- Add provideSplitIo() function with withConfig() and withFeatureOptions()
- Add SplitIoService
- Convert all 22 tests from done() callbacks to async/await with firstValueFrom
- Eliminate nested subscription anti-patterns in complex tests
- Update CONTRIBUTORS-GUIDE.md to reflect main branch workflow

All tests passing with 90% code coverage maintained.
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.

1 participant