Skip to content

Commit

Permalink
style: tsc lint
Browse files Browse the repository at this point in the history
  • Loading branch information
EtherWizard33 committed Oct 2, 2024
1 parent 3e0c0be commit 369dcd3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/components/Views/AccountPermissions/AccountPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,13 @@ const AccountPermissions = (props: AccountPermissionsProps) => {
);

const renderPermissionsSummaryScreen = useCallback(() => {
if (!isMultichainVersion1Enabled) {
return <React.Fragment />;
}

// reset the first render flag, so when it re-renders the checkbox list containing all accounts, that the permittend ones are selected
// this is a work around for the selected addresses being lost (why and when are they being lost anyway?)
if (
isMultichainVersion1Enabled &&
isFirstRenderOfEditingAllAccountPermissions.current === false
) {
if (isFirstRenderOfEditingAllAccountPermissions.current === false) {
isFirstRenderOfEditingAllAccountPermissions.current = true;
}

Expand Down Expand Up @@ -473,6 +474,10 @@ const AccountPermissions = (props: AccountPermissionsProps) => {
const renderEditAccountsPermissionsScreen = useCallback(() => {
let effectiveSelectedAddresses;

if (!isMultichainVersion1Enabled) {
return <React.Fragment />;
}

if (isFirstRenderOfEditingAllAccountPermissions.current) {
isFirstRenderOfEditingAllAccountPermissions.current = false;
effectiveSelectedAddresses = permittedAddresses;
Expand Down Expand Up @@ -610,15 +615,13 @@ const AccountPermissions = (props: AccountPermissionsProps) => {
case AccountPermissionsScreens.ConnectMoreAccounts:
return renderConnectMoreAccountsScreen();
case AccountPermissionsScreens.EditAccountsPermissions:
return (
isMultichainVersion1Enabled && renderEditAccountsPermissionsScreen()
);
return renderEditAccountsPermissionsScreen();
case AccountPermissionsScreens.ConnectMoreNetworks:
return isMultichainVersion1Enabled && renderConnectNetworksScreen();
return renderConnectNetworksScreen();
case AccountPermissionsScreens.Revoke:
return renderRevokeScreen();
case AccountPermissionsScreens.PermissionsSummary:
return isMultichainVersion1Enabled && renderPermissionsSummaryScreen();
return renderPermissionsSummaryScreen();
}
}, [
permissionsScreen,
Expand Down

0 comments on commit 369dcd3

Please sign in to comment.