question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

core: add a FeatureFlagged component

See original GitHub issue

Giving this a new home since https://github.com/backstage/backstage/issues/5394 is closed 😁

Feature Suggestion

Looking for feedback on the idea to add a single FeatureFlagged component for use in the app, that’ll both take care of acting as a switch but also register the feature flag. It would be implemented to work with the composability API, and simply act as a switch for whether its children should be renderer. Basically this:

const routes = (
  <FlatRoutes>
...
    <FeatureFlagged flag="show-welcome-page">
      <Route path="/welcome" element={<WelcomePage />} />
    <FeatureFlagged>
...
  <FlatRoutes>
)

Where the Route works as expected, is discovered in the app etc, and the "show-welcome-page" flag is both automatically registered as well as used to toggle whether the welcome page should be renderer. I’m not sure if that exact implementation is possible, but something of that sort x)

This’d lift the feature flag registration from plugins to the app, which we can ofc debate a bit 😉

Possible Implementation

TBD, looking at the idea first x)

Context

https://github.com/backstage/backstage/issues/5394

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sbrnunescommented, May 6, 2021

I was trying that approach, to hide the tabs that we still do not support, but this fails with Child of EntityLayout must be an EntityLayout.Route:

<EntityLayout>
   ...
   <FeatureToggled name="toggle">
      <EntityLayout.Route path="/ci-cd" title="CI/CD">
          {cicdContent}
      </EntityLayout.Route>
   </FeatureToggled>
   ...
</EntityLayout>

Any idea how to get around this?

1reaction
Rugvipcommented, May 31, 2021

A possible approach would be to standardize the child element collection functions added in https://github.com/backstage/backstage/pull/5677. If the collection function(s) end up being provided by the core library, we can have it stop depth traversal if it encounters a FeatureFlagged element with a flag that isn’t set. It’s a pretty deep integration but could potentially be worth it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial for using feature flags in a .NET Core app
In this tutorial, you will learn how to: Add feature flags in key parts of your application to control feature availability. Integrate with...
Read more >
Feature Flags · Backstage Software Catalog and Developer ...
The easiest way to control content based on the state of a feature flag is to use the FeatureFlagged component. import { FeatureFlagged...
Read more >
Add Feature Flags to Your Angular App in 10 Minutes - Split
We'll show you how to build a simple CRUD app using Angular components, services, models, and routing, and add feature flags branching by ......
Read more >
Implementing Feature Flags in Angular is easier than you ...
We add the directive *featureFlag in and pass the key for the feature to it. Done! We have successfully implemented Feature flags in...
Read more >
Feature Toggles (aka Feature Flags) - Martin Fowler
Working with feature-flagged systems. Expose current feature toggle ... Your team is responsible for the core simulation engine. You have been tasked with ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found