Skip to content

Commit

Permalink
Merge branch 'type_v1_fix' of github.com:MetaMask/metamask-mobile int…
Browse files Browse the repository at this point in the history
…o type_v1_fix
  • Loading branch information
jpuri committed Jan 23, 2025
2 parents 9bc7926 + 5b6021a commit 630c0ba
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
16 changes: 11 additions & 5 deletions app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,17 @@ const App = (props) => {
const sdkInit = useRef();
const [onboarded, setOnboarded] = useState(false);

trace({
name: TraceName.NavInit,
parentContext: getUIStartupSpan(),
op: TraceOperation.NavInit,
});
const isFirstRender = useRef(true);

if (isFirstRender.current) {
trace({
name: TraceName.NavInit,
parentContext: getUIStartupSpan(),
op: TraceOperation.NavInit,
});

isFirstRender.current = false;
}

const triggerSetCurrentRoute = (route) => {
dispatch(setCurrentRoute(route));
Expand Down
15 changes: 13 additions & 2 deletions app/components/UI/Tokens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ import { selectNetworkName } from '../../../selectors/networkInfos';
import ButtonIcon from '../../../component-library/components/Buttons/ButtonIcon';
import { selectAccountTokensAcrossChains } from '../../../selectors/multichain';
import { filterAssets } from './util/filterAssets';
import { TraceName, endTrace, trace } from '../../../util/trace';
import { getTraceTags } from '../../../util/sentry/tags';
import { store } from '../../../store';


// this will be imported from TokenRatesController when it is exported from there
// PR: https://github.com/MetaMask/core/pull/4622
Expand Down Expand Up @@ -145,6 +149,10 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
const styles = createStyles(colors);

const tokensList = useMemo((): TokenI[] => {
trace({
name: TraceName.Tokens,
tags: getTraceTags(store.getState()),
});
// if it is not popular network, display tokens only for current network
const filteredAssetsParam = isPopularNetwork
? tokenNetworkFilter
Expand Down Expand Up @@ -248,8 +256,11 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
...token,
tokenFiatAmount: tokenFiatBalances[i],
}));

return sortAssets(tokensWithBalances, tokenSortConfig);
const tokensSorted = sortAssets(tokensWithBalances, tokenSortConfig);
endTrace({
name: TraceName.Tokens,
});
return tokensSorted;
}
// Previous implementation
// Filter tokens based on hideZeroBalanceTokens flag
Expand Down
2 changes: 0 additions & 2 deletions app/util/sentry/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ export function setupSentry() {
beforeBreadcrumb: (breadcrumb) => rewriteBreadcrumb(breadcrumb),
beforeSendTransaction: (event) => excludeEvents(event),
enabled: metricsOptIn === AGREED,
// We need to deactivate this to have the same output consistently on IOS and Android
enableAutoPerformanceTracing: false,
});
};
init();
Expand Down
1 change: 1 addition & 0 deletions app/util/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export enum TraceName {
VaultCreation = 'Login Vault Creation',
AccountList = 'Account List',
StoreInit = 'Store Initialization',
Tokens = 'Tokens List',
}

export enum TraceOperation {
Expand Down

0 comments on commit 630c0ba

Please sign in to comment.