Skip to content

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Dec 22, 2025

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues
sdk-569

Describe the solution you've provided
- Introduced getLegacyStorageKeys method to as an optional internal option that could be configured per SDK.
- Updated LDClientImpl to support cleaning old persistent data based on the new option cleanOldPersistentData.
- Implemented getLegacyStorageKeys in Browser SDK so the feature is fully available there.
- Added a test to verify that old persistent data is cleaned while retaining current keys.

Additional context

Additionally I've added some refactors that would address the following:
- changing Flagstore + FlagUpdater classes to interface (starting SDK-1686) which saves us a few bytes
- Added a comment in LDClientImpl.ts to clarify that "override" changes are not being tracked as they are currently used only for debugging and not persisted. This may change in the future. (left over comment from a previous PR)


Note

Adds an option to clear legacy persistent storage keys (implemented for browser) and refactors FlagStore/FlagUpdater into factory-based interfaces with corresponding updates and tests.

Introduces optional cleanup of legacy persistent storage and refactors in-memory flag components.

  • Adds LDOptions.cleanOldPersistentData; LDClientImpl uses internalOptions.getLegacyStorageKeys() to asynchronously clear old keys (logs errors). Browser SDK implements getLegacyStorageKeys via new platform/LocalStorage.getAllStorageKeys and filters by ld:${clientSideId}:*.
  • Refactors flag internals: replace DefaultFlagStore/FlagUpdater classes with FlagStore interface + createDefaultFlagStore() and createFlagUpdater() factories; updates FlagManager, FlagPersistence, and tests accordingly.
  • Extends validators for cleanOldPersistentData and documents behavior; notes that "override" changes aren’t tracked for inspectors.
  • Adds tests for legacy key cleanup and maintains existing persistence behaviors.

Written by Cursor Bugbot for commit 6b67e86. This will update automatically on new commits. Configure here.

- Introduced `getLegacyStorageKeys` method to as an optional internal option that could be configured per SDK.
- Updated `LDClientImpl` to support cleaning old persistent data based on the new option `cleanOldPersistentData`.
- Implemented `getLegacyStorageKeys` in Browser SDK so the feature is fully available there.
- Added a test to verify that old persistent data is cleaned while retaining current keys.
- Added a comment in `LDClientImpl.ts` to clarify that "override" changes are not being tracked as they are currently used only for debugging and not persisted. This may change in the future.
@joker23 joker23 requested a review from a team as a code owner December 22, 2025 22:48
@github-actions
Copy link
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 169118 bytes
Compressed size limit: 200000
Uncompressed size: 789399 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25394 bytes
Compressed size limit: 26000
Uncompressed size: 124693 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 18730 bytes
Compressed size limit: 20000
Uncompressed size: 96409 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 23270 bytes
Compressed size limit: 25000
Uncompressed size: 80861 bytes

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.

2 participants