-
Notifications
You must be signed in to change notification settings - Fork 30
fix: Suggestions for serialization. #111
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
fix: Suggestions for serialization. #111
Conversation
const store: LDFeatureStore = { | ||
get( | ||
kind: DataKind, | ||
flagKey: string, |
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.
Isn't just flags.
throw new Error(`Error deserializing ${kindKey}`); | ||
} | ||
callback(item[kindKey][flagKey]); | ||
switch (kind.namespace) { |
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.
This isn't super elegant, but lets us keep the types the same, and we can make it more elegant in the next update.
return parsed; | ||
} | ||
|
||
/** |
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.
Just because this isn't a permanent solution, and isn't a function we want a customer to use.
} | ||
|
||
interface FlagsAndSegments { | ||
[key: string]: { [name: string]: Flag } | { [name: string]: Segment }; |
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.
FlagsAndSegments isn't intended to be addressed by strings. In places where it isn't flags or segments it would generally be an error. So, this is the main thing I was concerned about.
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.
Maybe long term DataKind
needs to be flags | segments
instead of string. But this is out of scope and out of time for my ambitions now.
export interface DataKind {
namespace: 'flags' | 'segments';
}
#107) * fix: fixed bug where the feature store does not deserialize KV values correctly. * chore: remove eslint comment * chore:update example to target rules rather than a contrived scenario. * chore: improve logging and nullish check. * chore: add yarn coverage * chore: debugging null debugEventsUntilDate * chore: set debugEventsUntilDate for unit tests. * fix: Suggestions for serialization. (#111) fix: Suggestions. * chore: removed .only * fix: broken unit tests. minor syntax improvements. --------- Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
No description provided.