Skip to content

fix: disable cache was not working#1187

Open
joker23 wants to merge 1 commit intomainfrom
skz/sdk-2023/disable-cache
Open

fix: disable cache was not working#1187
joker23 wants to merge 1 commit intomainfrom
skz/sdk-2023/disable-cache

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Mar 13, 2026

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-2023

Describe the solution you've provided

  • added an disableCache option
  • fixed the overall cache pruning behavior

Note

Medium Risk
Changes persistent flag caching behavior (read/write and eviction) and introduces a new disableCache option, which can affect offline fallback/initialization latency if misconfigured. Logic is covered by new unit tests but touches core persistence paths.

Overview
Fixes persistent flag caching so it can be explicitly disabled via a new disableCache option (plumbed through LDOptionsConfigurationLDClientImplDefaultFlagManagerFlagPersistence) and validated in configuration parsing.

Updates FlagPersistence to skip all cache reads/writes when disableCache is true or maxCachedContexts <= 0, while still pruning/clearing previously cached entries and ensuring pruned contexts (including equal-timestamp edge cases) are not re-written. Adds targeted tests covering maxCachedContexts=0, disableCache=true, and pruning behavior.

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


Open with Devin

@joker23
Copy link
Contributor Author

joker23 commented Mar 13, 2026

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@joker23 joker23 force-pushed the skz/sdk-2023/disable-cache branch from 431fce0 to 816c470 Compare March 13, 2026 21:44
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

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

@joker23 joker23 force-pushed the skz/sdk-2023/disable-cache branch from 816c470 to 6124cc1 Compare March 13, 2026 22:08
@github-actions
Copy link
Contributor

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

*
* @defaultValue false
*/
disableCache?: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may want to separate this one out for a feature release?

Copy link
Member

Choose a reason for hiding this comment

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

You could put:

BEGIN_COMMIT_OVERRIDE
fix: Max cached context enforcement wasn't working for 0.
feat: Add explicit disableCache setting.
END_COMMIT_OVERRIDE

Copy link
Member

Choose a reason for hiding this comment

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

We will probably want to use the disable cache setting in gonfalon as well.

@joker23 joker23 marked this pull request as ready for review March 13, 2026 23:00
@joker23 joker23 requested a review from a team as a code owner March 13, 2026 23:00
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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