Skip to content

Commit

Permalink
[#80] wrap with useCallback registration card texts
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Feb 7, 2024
1 parent 6d21f03 commit cff85e3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions govtool/frontend/src/components/organisms/DashboardCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const DashboardCards = () => {
formHexToBech32,
]);

const getRegistrationCardDescription = () => {
const getRegistrationCardDescription = useCallback(() => {
if (registerTransaction.transactionHash) {
switch (registerTransaction.type) {
case "retirement":
Expand All @@ -228,9 +228,14 @@ export const DashboardCards = () => {
} else {
return t("dashboard.registration.ifYouWant");
}
};
}, [
registerTransaction.transactionHash,
registerTransaction.type,
dRep?.isRegistered,
dRep?.wasRegistered,
]);

const getRegistrationCardTitle = () => {
const getRegistrationCardTitle = useCallback(() => {
if (registerTransaction?.transactionHash) {
switch (registerTransaction.type) {
case "retirement":
Expand All @@ -247,7 +252,12 @@ export const DashboardCards = () => {
} else {
return t("dashboard.registration.registerAsDRep");
}
};
}, [
registerTransaction?.transactionHash,
registerTransaction.type,
dRep?.isRegistered,
dRep?.wasRegistered,
]);

const renderGovActionSection = useCallback(() => {
return (
Expand Down

0 comments on commit cff85e3

Please sign in to comment.