codeforboston / maple

MAPLE makes it easy for anyone to view and submit testimony to the Massachusetts Legislature about the bills that will shape our future.
https://mapletestimony.org
MIT License
38 stars 106 forks source link

Feature Flag Overrides #1513

Closed Mephistic closed 1 month ago

Mephistic commented 1 month ago

Summary

This PR adds support for overriding feature flag values by setting a query parameter (e.g. ?myFlagName=enabled will force a flag on). This should work for most use cases (barring potentially SSG) and should make testing different flag states much easier.

This also make InstantSearch ignore unrelated query parameters. We need this to keep the search URL updates from obliterating our feature flag overrides (there are no flags on the search pages yet, but it seemed like too sharp of an edge to put off handling).

1503

Checklist

Screenshots

N/A

Known issues

N/A

Steps to test/reproduce

  1. Go to a page with a known flag-gated feature (like the Bill Tracker or Follow Org button)
  2. Set the flag as a query param with values of "enabled"/"disabled to test the different states
  3. Verify that the feature appears when the flag is enabled, disappears when it is disabled, and has the default behavior when no flag query param is set

Likely also worth testing the bill/testimony search pages - there should be no change in the functionality there

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
maple-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 23, 2024 5:06pm