Skip to content

Commit

Permalink
addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrans committed Oct 16, 2024
1 parent 27d1c07 commit 6d371dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions shared/modules/selectors/smart-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@ type SmartTransactionsMetaMaskState = {

/**
* Returns the user's explicit opt-in status for the smart transactions feature.
* This should only be used for reading the user's internal opt-in status, and
* not for determining if the smart transactions user preference is enabled.
*
* Do not export this selector. It should only be used internally within this file.
* To determine if the smart transactions user preference is enabled, use
* getSmartTransactionsPreferenceEnabled instead.
*
* @param state - The state object.
* @returns true if the user has explicitly opted in, false if they have opted out,
* or null if they have not explicitly opted in or out.
*/
const getSmartTransactionsOptInStatusInternal = createSelector(
export const getSmartTransactionsOptInStatusInternal = createSelector(
getPreferences,
(preferences: {
smartTransactionsOptInStatus?: boolean | null;
Expand Down
4 changes: 2 additions & 2 deletions ui/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import {
} from '../../shared/constants/metametrics';
import { parseSmartTransactionsError } from '../pages/swaps/swaps.util';
import { isEqualCaseInsensitive } from '../../shared/modules/string-utils';
import { getSmartTransactionsOptInStatusForMetrics } from '../../shared/modules/selectors';
import { getSmartTransactionsOptInStatusInternal } from '../../shared/modules/selectors';
import { NOTIFICATIONS_EXPIRATION_DELAY } from '../helpers/constants/notifications';
import {
fetchLocale,
Expand Down Expand Up @@ -3095,7 +3095,7 @@ export function setSmartTransactionsPreferenceEnabled(
): ThunkAction<void, MetaMaskReduxState, unknown, AnyAction> {
return async (dispatch, getState) => {
const smartTransactionsOptInStatus =
getSmartTransactionsOptInStatusForMetrics(getState());
getSmartTransactionsOptInStatusInternal(getState());
trackMetaMetricsEvent({
category: MetaMetricsEventCategory.Settings,
event: MetaMetricsEventName.SettingsUpdated,
Expand Down

0 comments on commit 6d371dc

Please sign in to comment.