Skip to content
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

feat: allow for new flag source #17806

Merged
merged 6 commits into from
Apr 27, 2020
Merged

feat: allow for new flag source #17806

merged 6 commits into from
Apr 27, 2020

Conversation

drdelambre
Copy link
Contributor

@drdelambre drdelambre commented Apr 20, 2020

some ground work for: https://github.com/influxdata/idpe/issues/6654
related to: #17851

the intended behavior is that a user gets their feature flags assigned to them on the server, whos state is sent to the client on a /api/v2/flags request. If a developer wants to override the feature flag on the client, or add a feature flag that is only used on the client, they can do so using an interface much like the current one.

the api work isn't merged yet, so this just moves the feature into redux, and allows the existing functionality to operate until we start fleshing out the contract


export type Actions = SetMe
export type Actions = ReturnType<typeof setMe>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

migrated to new reducer coding standard while i was in here

Copy link
Contributor

@asalem1 asalem1 left a comment

Choose a reason for hiding this comment

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

A couple of little questions, great job!

const seedStore = configureStore(localState, history)
const seedState = seedStore.getState()
clearStore()
Copy link
Contributor

Choose a reason for hiding this comment

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

this whole process seems a bit circuitous. Is this all being done to simply ensure that the initialState is set correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to share the store around the app without recreating stores, i had to make it a singleton, which makes sense for a single page app. maybe a slight interface change to allow for multiple stores to be created will be required in the future, but the desired outcome is to provide the developer the ability to say "give me the store" without explicitly plumbing it everywhere. There be some abstraction dragons here, but i like to think we're using the store as a singleton anyways, just allowing connect to be that interface that obfuscates the plumbing for us, so it's not THAT bad. the clearStore works like how we use the /debug/flush endpoint for e2e tests, so that we can inject fresh data into the singleton on every test. This specific stuff looks weird because we're using a store to load a store, but overwrite specific things, instead of injecting a default store with overrides, which i can imagine is to allow for greater flexibility in how that default store gets defined / created and more easily mirror actual application state than keeping a derived state in sync with an explicit one.

@drdelambre drdelambre merged commit 5c00430 into master Apr 27, 2020
@drdelambre drdelambre deleted the alex_flags branch April 27, 2020 17:12
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