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

Default flags are ignored during the first render #1673

Open
taschetto opened this issue Sep 6, 2022 · 2 comments
Open

Default flags are ignored during the first render #1673

taschetto opened this issue Sep 6, 2022 · 2 comments

Comments

@taschetto
Copy link

Describe the bug
Flags are evaluated as false during the first render even if default flags are provided.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/taschetto/flopflip-bug
  2. yarn && yarn start
  3. Open the console DevTools in your preferred browser
  4. Notice that the first render outputs false for all feature flags, even though the defaults are different
  5. Then, eventually, the flags assume the default value

Expected behavior
Any tentative to evaluate flags should read from the default flags even during the first render.

Screenshots

image

@tdeekens
Copy link
Owner

tdeekens commented Sep 6, 2022

Hi, thanks for reporting the issue. Personally I've not perceived this as an issue so far but that depends on the case. Have you had a look around the library to gauge how to possibly fix it?

@taschetto
Copy link
Author

taschetto commented Sep 7, 2022

I consider this an inconvenience, especially for non-boolean feature flags. For example, that particular flag dashboardColor has many variants that return a hex color. If I try to use the variant as-is in CSS properties, I'll have an invalid value during a few renders. Of course, this can be circumvented in the consumer with some explicit defaults/fallbacks, but it begins to be a hassle once your consumers grow in complexity or number. This can be a problem while writing unit tests as well since the first render will not include the valid flags, and we need to introduce some mechanism to wait for it to be in the correct state.

Yes, I read the documentation, but so far, I couldn't find a solution.

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

No branches or pull requests

2 participants