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

question: arrow colors being changed at every render #18

Closed
tusharnankani opened this issue Apr 11, 2022 · 1 comment
Closed

question: arrow colors being changed at every render #18

tusharnankani opened this issue Apr 11, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@tusharnankani
Copy link

tusharnankani commented Apr 11, 2022

Why are the arrow colors being changed at every render?

git-graph-q.mp4

The website gets very junky and gives a lag for huge .git folders when it is processing this for every click/render.

@HarshKapadia2
Copy link
Owner

Why are the arrow colors being changed at every render?

That is because of a re-render. Arrow colours are randomized. The re-renders were because there are a lot of state variables and setting even one of them re-renders all components.

I had not thought about Memoization and other methods to prevent re-renders till date, but I came across a PR on React.memo()'s RFC today by chance and that prompted me looking up some stuff (linked below) and using React.memo() in conjunction with useCallback() to Memoize the GraphArea component.

The resources that I referred to:

The website gets very junky and gives a lag for huge .git folders when it is processing this for every click/render.

Agreed. This has been solved in commit 95428cc. Thank you so much for this issue @tusharnankani, it prompted me to look for a solution.

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

No branches or pull requests

2 participants