Frontend School

Feature Flag Management Dashboard

Machine Coding
medium

Feature Flag Management Dashboard

Medium
React
TypeScript
State Management
Data Fetching
Component Design

Your task is to build a simple dashboard for managing feature flags. Feature flags are used to turn features on or off in an application without deploying new code.

You will be provided with a mock API to fetch and update these flags.

Core Features:

  1. Display Flags:

    • On initial load, fetch a list of feature flags from the mock API.
    • Display a loading indicator while the data is being fetched.
    • Display an appropriate error message if the API call fails.
    • Render each flag's name, description, and its current status.
  2. Filtering & Searching:

    • Add controls to filter the list of flags by their status (ENABLED, DISABLED). A set of radio buttons or a dropdown would be suitable.
    • Include a text input to search for flags by their name.
    • The search functionality should be debounced to avoid excessive filtering on every keystroke.
  3. Toggle Status (Optimistic Update):

    • Next to each flag, render a toggle switch to enable or disable it.
    • When a user clicks the toggle, the UI should immediately reflect the new state (optimistic update).
    • In the background, make an API call to persist the change.
    • If the API call succeeds, the new state is confirmed.
    • If the API call fails, the toggle should revert to its original state, and an error message should be briefly displayed to the user.

Constraints

  • Use React with TypeScript.
  • Use only functional components and hooks (useState, useEffect, useCallback, etc.).
  • A mock API module is provided in the starter code. You should not modify it, but you must use it for data fetching and updates.
  • You are not required to use any external state management libraries (like Redux or MobX), but useState and useReducer are sufficient.
  • Focus on functionality, component structure, and state management. Styling is secondary, but the application should be usable.

Loading editor...