Skip to content

fix: normalize injection tokens to standard Angular pattern#70

Merged
michaelbe812 merged 4 commits into
mainfrom
fix/normalize-injection-tokens
Sep 16, 2025
Merged

fix: normalize injection tokens to standard Angular pattern#70
michaelbe812 merged 4 commits into
mainfrom
fix/normalize-injection-tokens

Conversation

@michaelbe812

Copy link
Copy Markdown
Owner

Summary

  • Normalized injection tokens to follow standard Angular conventions
  • Replaced function-based tokens with direct InjectionToken instances
  • Added comprehensive tests for token injection

Related Issue

Fixes #54

Changes Made

1. Token Definition Updates

  • RX_STATEFUL_CONFIG: Changed from function returning token to direct token instance
  • RX_STATEFUL_CLIENT_CONFIG: Changed from function returning token to direct token instance

2. Provider Updates

  • Updated provideRxStatefulConfig() to use new token directly
  • Updated withConfig() to use new token directly

3. Testing

  • Added new test suite for injection token behavior
  • Verified all existing tests pass
  • Confirmed demo app builds and runs correctly

Breaking Change

This is a breaking change for users directly injecting the tokens (rare case).

Migration Required

If you were using the tokens directly:

  • Old: inject(RX_STATEFUL_CONFIG())
  • New: inject(RX_STATEFUL_CONFIG)

Note: Most users only use provideRxStatefulConfig() or rxRequest() and will not need any changes.

Testing Performed

  • ✅ All unit tests pass
  • ✅ Library builds successfully
  • ✅ Demo app runs without errors
  • ✅ Linting passes

Checklist

  • Code follows project conventions
  • Tests added/updated
  • Documentation updated (CHANGELOG)
  • Breaking change documented
  • All checks passing

Mac Mini and others added 4 commits September 16, 2025 07:13
- Replace function-based tokens with standard InjectionToken instances
- Update RX_STATEFUL_CONFIG to use direct token instead of function
- Update RX_STATEFUL_CLIENT_CONFIG to use direct token instead of function
- Update provider functions to use new tokens directly
- Verify token injection works correctly with new pattern
- Test optional injection returns null when not provided
- Document breaking change in CHANGELOG
- Provide clear migration instructions
- Note that most users won't be affected
@michaelbe812
michaelbe812 merged commit 026bcc1 into main Sep 16, 2025
1 check failed
@michaelbe812
michaelbe812 deleted the fix/normalize-injection-tokens branch September 16, 2025 13:11
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.

Normalize injection tokens to standard Angular pattern

1 participant