The current implementation as a result of the PR that addresses that ticket is, in short:
The disabled property is hard-coded to false (the modal is always enabled)
The component renders the modal if the feature toggle is on, and returns <></> otherwise.
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.
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:
disabled
property is hard-coded to false (the modal is always enabled)<></>
otherwise.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.
Program
Platform CMS Team
Sitewide Crew
⭐️ Sitewide CMS
⭐️ Public Websites
⭐️ Facilities
⭐️ User support