-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat(27256): implement remote feature flag feature #28684
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: app/scripts/background.js
Did you find this useful? React with a 👍 or 👎 |
3942cd2
to
9bddc8d
Compare
@@ -60,7 +61,7 @@ const mapStateToProps = (state, ownProps) => { | |||
const { | |||
metamask: { currencyRates }, | |||
} = state; | |||
|
|||
const remoteFeatureFlags = getRemoteFeatureFlags(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be removed after 1st feature flag is implemented in production
@@ -53,6 +57,13 @@ export default class InfoTab extends PureComponent { | |||
componentDidMount() { | |||
const { t } = this.context; | |||
handleSettingsRefs(t, t('about'), this.settingsRefs); | |||
if (this.props.remoteFeatureFlags.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be removed after 1st feature flag is implemented in production
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of (this.props.remoteFeatureFlags.length > 0, can we use an actual feature flag. So that this becomes something like
if (this.props.remoteFeatureFlags[TEST_FLAG] > 0) {
console.log(
So we can fully demonstrate how teams would use the feature flag system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, added 5204e9c
app/scripts/background.js
Outdated
@@ -885,12 +884,16 @@ export function setupController( | |||
senderUrl?.origin === `chrome-extension://${browser.runtime.id}`; | |||
} | |||
|
|||
controller.remoteFeatureFlagController.getRemoteFeatureFlags(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will need error handling here now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and should we remove the controller.remoteFeatureFlagController.getRemoteFeatureFlags()
call on 887, because we have one on 896?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this line is removed, it was for testing purpose 🙏🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error handling within initializeRemoteFeatureFlags
can be found 5204e9c
0e78bb0
to
e1c605a
Compare
d6d0a91
to
a2b12b6
Compare
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
a2b12b6
to
79cdc1c
Compare
This reverts commit 5a8a088.
517fd2c
to
7421c8e
Compare
Builds ready [7421c8e]
Page Load Metrics (1790 ± 41 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
7421c8e
to
6d474f7
Compare
@metamaskbot update-policies |
No policy changes |
Builds ready [6d474f7]
Page Load Metrics (2456 ± 138 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Builds ready [2818e50]
Page Load Metrics (2185 ± 102 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! great work on this!
@@ -1094,6 +1095,22 @@ export function setupController( | |||
} | |||
} | |||
|
|||
/** | |||
* Initializes remote feature flags by making a request to fetch them from the clientConfigApi. | |||
* This function is called when MM is during internal process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* This function is called when MM is during internal process. | |
* This function is called during initialization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just left a small nit
Description
Related issues
Fixes: #27256
Manual testing steps
chrome.storage.local.get(console.log)
in dev tools console, and you'll find indata
=>RemoteFeatureFlagController
=> contains 2 dataset,cacheTimestamp
andremoteFeatureFlags
with valuedownload stage logs
button, you'll findremoteFeatureFlags
with cached value in your state.Feature flag fetched successfully
, which will be removed after we implement 1st feature flag in productionScreenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist