Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17178 - Alteration - Feature flag - Change Business Types #520

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

seeker25
Copy link
Collaborator

Issue #: /bcgov/entity#17178

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the bcrs-entities-create-ui license (Apache 2.0).

@seeker25 seeker25 requested a review from Jxio July 25, 2023 14:32
@seeker25 seeker25 self-assigned this Jul 25, 2023
@seeker25 seeker25 changed the title 17178 - Alteration - Feature flagging - Change Business Types 17178 - Alteration - Feature flag - Change Business Types Jul 25, 2023
@seeker25
Copy link
Collaborator Author

seeker25 commented Jul 25, 2023

Controls the options and hides this button, if the business type isn't in the list:

BEN and BC currently enabled on LD for TEST/PROD - all 4 options enabled in DEV, BEN, BC, CC, ULC

image

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #520 (3ee4d85) into main (e481296) will decrease coverage by 0.07%.
Report is 3 commits behind head on main.
The diff coverage is 60.00%.

❗ Current head 3ee4d85 differs from pull request most recent head 2e2ce3d. Consider uploading reports for the commit 2e2ce3d to get more accurate results

@@            Coverage Diff             @@
##             main     #520      +/-   ##
==========================================
- Coverage   87.11%   87.04%   -0.07%     
==========================================
  Files         207      207              
  Lines        3919     3922       +3     
  Branches      510      510              
==========================================
  Hits         3414     3414              
- Misses        491      494       +3     
  Partials       14       14              
Files Changed Coverage Δ
src/store/store.ts 82.68% <0.00%> (-0.23%) ⬇️
...mponents/common/YourCompany/ChangeBusinessType.vue 100.00% <100.00%> (ø)
src/utils/feature-flag-utils.ts 41.17% <100.00%> (-5.89%) ⬇️

package.json Outdated Show resolved Hide resolved
@@ -7,14 +7,15 @@ declare const window: any
* Default flag values when LD is not available.
* Uses "business-edit" project (per LD client id in config).
*/
const defaultFlagSet: LDFlagSet = {
export const defaultFlagSet: LDFlagSet = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exported this, so I could use it in the setup

// Mock feature flags for unit tests.
jest.spyOn(util, 'GetFeatureFlag').mockImplementation(
(name) => {
if (name === 'supported-alteration-change-business-types') {
Copy link
Collaborator Author

@seeker25 seeker25 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is too global, let me know, I can call a function instead in the 2-3 sections that need it

I will create another PR and clean it up if needed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too global -- other features may want different feature flags.

Nice code, though :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding it to the list for next PR

@seeker25
Copy link
Collaborator Author

seeker25 commented Jul 25, 2023

CI is being very slow

image

image

@seeker25 seeker25 merged commit c3b5106 into bcgov:main Jul 25, 2023

/** Called when component is mounted. */
mounted (): void {
this.initializeEntityType()
this.supportedEntityTypes = GetFeatureFlag('supported-alteration-change-business-types') || []
this.supportedEntityTypes = GetFeatureFlag('supported-alteration-change-business-types')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still fall back to [] in case LD returns null/undefined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahah I had a feeling - ok adding it to the list. We're going to have to make some more changes for the payment codes I believe

Copy link
Collaborator

@severinbeauvais severinbeauvais Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the conditional chaining on line 325 that you don't need if this variable is always an array (not falsy).

My guideline: don't use conditional chaining any more than you have to since it can hide errors (something that you'd want to catch during development or testing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants