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.

Plugin Feature Flag Feature Not Working as Documented

See original GitHub issue

Expected Behavior

The following should enable a Feature Flag and it currently doesn’t:

import {
    createPlugin,
    createRoutableExtension,
    createRouteRef,
  } from '@backstage/core';
  import WelcomePageComponent from '../pages/WelcomePage';
  
  export const rootRouteRef = createRouteRef({
    title: 'Welcome',
  });
  
  export const welcomePlugin = createPlugin({
    id: 'welcome',
    register({ router, featureFlags }) {
      router.addRoute(rootRouteRef, WelcomePageComponent);
      featureFlags.register('enable-welcome-box');
    },
  });

When going to /settings/feature-flags i still see No Feature Flags

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Rugvipcommented, Apr 26, 2021

Yeah feature flag API is a bit behind the composability work, iirc it’s currently only possible to check if a flag is active via the API itself, meaning that you’ll need to manually check the state of the flag and then not render the rest of the react tree within your own component. We definitely want to provide some more utilities to make feature flags easier to work with.

One idea is to just have 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 😉

0reactions
augustomeireles05commented, Jul 29, 2022

Hy there, Rugvip. If it’s possible, I would like to take some doubt with you: I need to know how to disable this option from the screen. I saw on core-plugin-api folder into node modules that exist a FeatureFlagState Enum where we can declare an attribute none 0. How to put in a component SidebarSettings to disable this element?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable the feature flag for the structured data blocks?
The feature will disable it if selected. Disabling our caching can sometimes fix issues related to the sitemaps. If you are not experiencing...
Read more >
Document features deployed behind feature flags - GitLab Docs
A FLAG note renders on the GitLab documentation site as: On self-managed GitLab, by default this feature is not available. To make it...
Read more >
Using Feature Flags | Cloud Foundry Docs
This topic describes how Cloud Foundry admins can set feature flags using the Cloud Foundry Command Line Interface (cf CLI) to enable or ......
Read more >
Integrate with feature flags - Atlassian Support
Split's documentation. Once the flag has a Jira issue key linked to it, you will see feature flag information in the following places:...
Read more >
Feature Flags: What They Are and How to Use Them
Learn about feature flags, the benefits they bring, and how the Space ... Our feature flags are tightly connected to issues in our...
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