Skip to content

Feature/add all flags setting #21

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

Closed
wants to merge 6 commits into from

Conversation

mlund01
Copy link

@mlund01 mlund01 commented Aug 30, 2018

Problem
We have over 100 feature flags that we use within our app, and it's challenging to maintain a list of default values in the flags object that gets passed to the init method when the majority of them don't need to have a preset and can wait until the LD server returns with actual flag values.

Solution
This MR adds the ability to get all flags by setting allFlags: true in the new settings object param for the init method. i.e.

const flags = {'test-one': true, 'test-two': false}
ldRedux.init({
  clientSideId: 'your-client-side-id',
  dispatch: store.dispatch,
  flags,
  settings: {allFlags: true},
});

This feature can be used in combination with the flags object, but is no longer necessary if the allFlags option is set. An example without flags,

ldRedux.init({
  clientSideId: 'your-client-side-id',
  dispatch: store.dispatch,
  settings: {allFlags: true},
});

@mlund01 mlund01 changed the title Feature/add all flags option Feature/add all flags setting Aug 30, 2018
@yusinto
Copy link
Owner

yusinto commented Aug 31, 2018

Hi @mlund01 I hope you don't mind I created a new release based on your requirements, which will achieve what you want. Basically the flags argument is now optional and will default to all flags when not specified. Check out the release here. Thanks for the pr!

@yusinto yusinto closed this Aug 31, 2018
@mlund01
Copy link
Author

mlund01 commented Aug 31, 2018

@yusinto your changes certainly make it more flexible in a concise way. However, it would be nice to be able to pass both the flags argument and be able to get all flags. The reason for this is because some of our flags are easier to work with if there is a default value (typically the flags that get evaluated early in the load cycle when LD may not yet be loaded). I'll leave it up to you since we can work around since ld-redux-components allow you to wait for ld to be loaded and set default variants on flag components, but that's my two cents.

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