Archiving old flags

There are two ways of removing flags from a LaunchDarkly project:

  1. Archiving a flag hides it from the main flag list on the Dashboard. LaunchDarkly retains the flag's configurations, but doesn't use them any more. This makes it easy to restore the flag and its settings if needed. It also prevents the creation of a new flag with the same key as the archived flag. This is important, as the reuse of flag identifiers can cause disastrous bugs.
  2. Deleting a flag permanently removes the flag and its configuration from LaunchDarkly. It frees up the flag identifier so that it can be reused by a new flag. Flags can only be deleted after they have already been archived. In general, we recommend against deleting flags, as it opens up the possibility of creating the kind of bugs mentioned above.

And that's it! You've now cleaned up the last of the space-mode flag, making your app's code easier to maintain. It's been easy in this tutorial, but when working on multiple code changes as part of a busy team, flag hygiene can be harder to maintain. In the next step, you'll see common approaches to keeping code clean.