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

Better feature flag types and add forks route flag #264

Merged

Conversation

jamescdavis
Copy link
Member

Purpose

Improve types for route feature flags and add the missing forks route flag. These changes will restrict references to only known route flags, but you can typecast to string index type to still allow lookup based on a variable (e.g. transition target route name, as demonstrated in app/router.ts).

Summary of Changes

Improve types for route feature flags and add the missing forks route flag.

Side Effects / Testing Notes

Each route flag key will need to be added to config/environment.d.ts

Ticket

n/a

Reviewer Checklist

  • meets requirements
  • easy to understand
  • DRY
  • testable and includes test(s)
  • changes described in CHANGELOG.md

@coveralls
Copy link

coveralls commented May 9, 2018

Coverage Status

Coverage increased (+0.02%) to 56.541% when pulling 0b7a536 on jamescdavis:better_feature_flag_types into 08cced9 on CenterForOpenScience:develop.

featureFlags: {
routes,
},
} = config as { featureFlags: { routes: { [index: string]: string } } }; // eslint-disable-line no-use-before-define
Copy link
Member Author

@jamescdavis jamescdavis May 9, 2018

Choose a reason for hiding this comment

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

The eslint-disable-line no-use-before-define is needed due to eslint/typescript-eslint-parser#435

@@ -181,6 +181,7 @@ module.exports = function(environment) {
dashboard: 'ember_home_page',
home: 'ember_home_page',
institutions: 'ember_institutional_landing_page',
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we have a flag for the route, only the updated flag for the menu item which will probably be institutions_nav_bar. https://github.com/CenterForOpenScience/osf.io/pull/8333/files#diff-758f58f82207e3674b3105d2b3d4ce7aR127

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed. I wonder if we should flag the route though. In this case, the Ember app wouldn't reload, but just go to page not found.

Copy link
Contributor

@brianjgeiger brianjgeiger May 9, 2018

Choose a reason for hiding this comment

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

The thought was that, because the page doesn't exist, if we don't tell anyone about it, there's no reason for anyone to go to the route. It will either need to be on for everyone or no-one, but not showing the menu item is a valid thing to hide to make it easier to sync between teams.

@jamescdavis jamescdavis merged commit 5707a34 into CenterForOpenScience:develop May 15, 2018
@jamescdavis jamescdavis deleted the better_feature_flag_types branch May 15, 2018 14:52
@jamescdavis jamescdavis added this to the 0.4.0 milestone Jun 26, 2018
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.

3 participants