Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Make feature toggle decision at mount time instead of build time #827

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

rohithbalaji123
Copy link
Member

Part of #612

Current Behavior ( Optional for new feature )

Description

The feature toggle and auth toggle decision is currently being made in constructor of UIFactory making it happen only once during the initial setup unless the page is reloaded. With the current dynamic(auth based) feature toggle functionality in place, this won't work as users will keep alternating between logged in and out state. That is, when a user is initially logged out, the permission based features will be unavailable and it will continue to be unavailable even after logging in.

New Behavior

Description

Instead of passing the decision(Promise<bool>) in the withFeatureToggle and withPageAuth HOCs, we pass the decision maker so that it can be called while mounting the component and thus satisfying the dynamicity.

@rohithbalaji123 rohithbalaji123 added the bug Something isn't working label Jun 3, 2020
@rohithbalaji123 rohithbalaji123 self-assigned this Jun 3, 2020
@codecov
Copy link

codecov bot commented Jun 3, 2020

Codecov Report

Merging #827 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #827   +/-   ##
=======================================
  Coverage   50.03%   50.03%           
=======================================
  Files         123      123           
  Lines        2650     2650           
  Branches      147      147           
=======================================
  Hits         1326     1326           
  Misses       1274     1274           
  Partials       50       50           
Flag Coverage Δ
#golang 70.50% <ø> (ø)
#typescript 23.66% <0.00%> (ø)
Impacted Files Coverage Δ
frontend/src/component/UIFactory.tsx 0.00% <0.00%> (ø)
frontend/src/component/hoc/withFeatureToggle.tsx 0.00% <0.00%> (ø)
frontend/src/component/hoc/withPageAuth.tsx 0.00% <0.00%> (ø)
...ervice/feature-decision/DynamicDecision.service.ts 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 735ff11...5672c12. Read the comment docs.

@rohithbalaji123 rohithbalaji123 merged commit e99ef6b into master Jun 3, 2020
@rohithbalaji123 rohithbalaji123 deleted the upt-auth-hoc branch June 3, 2020 05:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants