Skip to content

Conversation

@petruki
Copy link
Member

@petruki petruki commented Jan 8, 2026

This pull request introduces several improvements and refactors to the Switcher Client JS SDK, focusing on simplifying the API for checking feature flags, improving switcher instance management, and updating documentation and tests accordingly. The main highlights are the refactoring of the Switcher API to allow calling methods without explicitly passing a feature key each time, the introduction of persisted switcher instances in the Client, and comprehensive updates to documentation and tests to reflect these changes.

API Refactoring and Simplification

  • Refactored Switcher methods (isItOn, isItOnBool, isItOnDetail) so that once a switcher is obtained with a key (e.g., Client.getSwitcher('FEATURE01')), subsequent calls to these methods no longer require the key to be passed as an argument. This results in cleaner and less error-prone code.
  • Updated all usage examples, tests, and playground scripts to reflect the new API, removing redundant feature key arguments from method calls. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Switcher Instance Management

  • Introduced persisted switcher instances in Client.getSwitcher(key). When a switcher is requested with a key, the same instance is returned for subsequent requests with the same key, ensuring consistency and potentially improving performance. [1] [2]
  • Added tests to verify that requesting a switcher with the same key returns the same instance, and different keys return different instances.

Documentation and Dependency Updates

  • Updated the README.md to clarify the new API usage and terminology, including the distinction between persisted and non-persisted switcher instances. [1] [2] [3]
  • Upgraded TypeScript ESLint dependencies in package.json for improved linting support.
  • Minor documentation fix in the playground example to reference the correct SDK name.

@petruki petruki added this to the v4.5.1 milestone Jan 8, 2026
@petruki petruki self-assigned this Jan 8, 2026
@petruki petruki added the enhancement New feature or request label Jan 8, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@petruki petruki merged commit 98d2690 into master Jan 8, 2026
13 checks passed
@petruki petruki deleted the staging branch January 8, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants