department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
99 stars 69 forks source link

Update Announcement framework to access feature toggles #11962

Open ryguyk opened 1 year ago

ryguyk commented 1 year ago

Description

Context

In https://github.com/department-of-veterans-affairs/va.gov-cms/issues/11535, we implemented a modal whose visibility needs to be determined by a feature toggle (i.e. when feature is on, modal shows; when off, doesn't show).

The current implementation as a result of the PR that addresses that ticket is, in short:

This works, but it's not the best solution. It's technically rendering the announcement without actually displaying it to the user. As long as there is only one announcement set to display, this is probably fine. However, in the case where there are multiple, this would block the display of others because the user would never be able to dismiss this one.

The Announcement widget/framework is designed around the disabled property being a critical piece of the puzzle. We should define our announcements accordingly. However, at present, we cannot.

The problem

The current implementation of the framework does not allow configured Announcements to access Flipper feature toggles. You can call any logic you desire to define the disabled property, but that logic is not able to access feature toggles (unless it is in a static method on a class component; we prefer functional components).

A path forward

Currently, the disabled property is strictly a boolean. You can call any function you'd like to define that value, but it's a boolean. We can, instead, allow this to be either a boolean or a function that gets the feature toggles passed in as a parameter.

Acceptance Criteria

CMS Team

Please check the team(s) that will do this work.

jilladams commented 1 year ago

Refinement discussion, @ryguyk @davidconlon :

For follow up in early 2023. Needs ACs.