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

Reload button to manually reload file tree #108

Merged
merged 8 commits into from
Sep 8, 2021
Merged

Conversation

Linus045
Copy link
Contributor

@Linus045 Linus045 commented Apr 22, 2020

When looking at a single commit of a PR the file tree doesn't update correctly when the page is still loading.
This is because we stop trying to reload the file tree after the first time since we can't get the changed file count for the single commit.

I added a reload button that manually reloads the file tree when clicked.
Additionally I added a feature so that if you look at a single commit, it tries to refresh the tree a few times (max. 10 times currently).

Normally I don't program in React so there might be some things that can be done in a better fashion.

image

@Linus045
Copy link
Contributor Author

Linus045 commented Apr 22, 2020

This might also acts as a workaround for #67

@berzniz berzniz added this to the 1.0.30 milestone Apr 23, 2020
@berzniz
Copy link
Owner

berzniz commented Apr 23, 2020

Thanks @Linus045 ! I will go over it soon (crazy times so may take more time than usual) and it should be included in the next version.

@berzniz berzniz modified the milestones: 1.0.30, 1.0.31 May 1, 2020
@berzniz berzniz modified the milestones: 1.0.31, 1.0.32, 1.0.33 Sep 18, 2020
@yeikel
Copy link

yeikel commented Oct 9, 2020

This looks like a nice feature. How can I help to test this change?

@Linus045
Copy link
Contributor Author

Linus045 commented Jan 3, 2021

I suppose you can checkout this branch, build and add the extension to your browser and see how it performs on small and big pull requests.

The main goal is to fix the problem with github's batch loading when the PR contains a lot of changes.
Not all files are loaded instantaneously but rather it's split up in small batches.

Currently the tree is generated once and only updates when you type something in the filter bar.
This causes problems because not all files that changed are listed in the sidebar after the first batch load.
This PR adds the ability to manually reload the tree as well as automatically tries to reload the tree a few times when you filter for something (10 times max with 2 second delay in-between).

(There is an if statement to check if the sidebar file count and actual shown files count match and if not it will reload the tree, but iirc that doesn't work, therefore I added the automatic reload)

@berzniz
Copy link
Owner

berzniz commented Aug 27, 2021

Back after a long while to revisit this. I can accept this after:

  • Removing all changes that are not related to the button itself. These can be in another PR since they are not related.
  • Removing the bind(this) on every render which creates a new function. Please change the method to be bounded to the instance by default (method = () => {})

@Linus045
Copy link
Contributor Author

I removed the automatic reloading and replaced the bind(this) function with an arrow function.

@berzniz berzniz merged commit b54ad6a into berzniz:master Sep 8, 2021
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.

3 participants