[refactor] Update SvelteLDClient to use proxy for flag variations. Allows to track flag evaluations #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several significant changes to the
SvelteLDClient
in thesvelte
SDK package. The changes focus on improving the handling of flag variations, updating dependencies, and adding a new proxy mechanism for flag access.Improvements to flag variation handling:
packages/sdk/svelte/src/lib/client/SvelteLDClient.ts
: Added a newtoFlagsProxy
function to create a proxy for the flags object, which intercepts access to flag values and returns the appropriate variation. This ensures that the flag values are correctly fetched from the LaunchDarkly client.Updates to dependencies:
packages/sdk/svelte/package.json
: Removed@launchdarkly/js-client-sdk-common
from bothpeerDependencies
anddependencies
.Enhancements to test cases:
packages/sdk/svelte/__tests__/lib/client/SvelteLDClient.test.ts
: Modified thevariation
mock to return the default value and added an event emission for the 'ready' event to set initial flag values in the test cases. [1] [2]Refactoring for consistency:
packages/sdk/svelte/src/lib/client/SvelteLDClient.ts
: Replaced references tojsSdk
withcoreLdClient
for consistency and clarity in thecreateLD
function. [1] [2] [3]