Skip to content
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

fix: time ago refresh #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix: time ago refresh #15

wants to merge 1 commit into from

Conversation

amper-fb
Copy link
Collaborator

@amper-fb amper-fb commented Nov 7, 2023

No description provided.

@@ -138,6 +139,14 @@ export const TransactionRow: React.FC<IProps> = ({ tx }) => {
};
}, []);

// update "time ago" every 5 secs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this useEffect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without it, the state doesn't get updated and there's no re-render of the row, maybe it needs to be 1 level outside in the container and not per row?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so maybe create a TimeAgo component that gets a timestamp and does the useEffect internally. or install https://www.npmjs.com/package/react-time-ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants