-
Notifications
You must be signed in to change notification settings - Fork 6
[FME-12059] SDK_UPDATE with metadata #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
Use initalCacheLad instead of isCacheValid
sdk_ready metadata
| * Metadata keys for SDK update events. | ||
| * Use the string literals directly: 'FLAGS_UPDATE' or 'SEGMENTS_UPDATE' | ||
| */ | ||
| type SdkUpdateMetadataKeys = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this type in order to simplify the Public API. This type is not used anywhere internally, and from the perspective of the TypeScript user, it doesn't seem very useful:
client.on(client.Event.SDK_UPDATE, (metadata) => {
if (metadata.type === 'FLAGS_UPDATED' as SplitIO.SdkUpdateMetadataKeys['FLAGS_UPDATE']) {
doSomethingForFlagsUpdated
}
});
vs
client.on(client.Event.SDK_UPDATE, (metadata) => {
if (metadata.type === 'FLAGS_UPDATED') {
doSomethingForFlagsUpdated
}
});
I would remove it for now and reconsider adding it or something else in the future.
Besides, we are using union types for similar string enum types (example SDKMode, StorageType, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about replacing it with something like
/**
* Metadata for the update event emitted when the SDK cache is updated with new data for flags or segments.
*/
type SdkUpdateMetadata = {
/**
* The type of update event.
*/
type: SdkUpdateMetadataKey
/**
* The names of the flags or segments that were updated.
*/
names: string[]
}
/**
* Metadata keys for SDK update events.
* Use the string literals directly: 'FLAGS_UPDATE' or 'SEGMENTS_UPDATE'
*/
type SdkUpdateMetadataKey = 'FLAGS_UPDATE' | 'SEGMENTS_UPDATE';
JavaScript commons library
What did you accomplish?
How do we test the changes introduced in this PR?
Extra Notes