From 05e2615b4b2f593321fedbdf231e54a2185af2f6 Mon Sep 17 00:00:00 2001 From: Linus045 Date: Wed, 22 Apr 2020 23:05:33 +0200 Subject: [PATCH 1/5] Added reload button to manually reload the file tree --- src/js/components/actions/index.jsx | 10 +++++++++- src/js/components/tree/index.jsx | 2 ++ src/js/index.jsx | 7 ++++++- src/js/style.css | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/js/components/actions/index.jsx b/src/js/components/actions/index.jsx index be92655..841fe6c 100644 --- a/src/js/components/actions/index.jsx +++ b/src/js/components/actions/index.jsx @@ -1,9 +1,17 @@ import React from 'react' -const Actions = ({ filter, filterFiles, onFullWidth, onOptions, onClose }) => ( +const Actions = ({ filter, filterFiles, onFullWidth, onOptions, onClose, onReloadTree }) => (
+
+ +
+
From 3735193d30678f4fb10c698385c799e3858b8a73 Mon Sep 17 00:00:00 2001 From: Linus045 Date: Mon, 30 Aug 2021 13:11:06 +0200 Subject: [PATCH 4/5] Removed changes unrelated to the button itself --- src/js/index.jsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/js/index.jsx b/src/js/index.jsx index 81b8f96..f56f8c0 100644 --- a/src/js/index.jsx +++ b/src/js/index.jsx @@ -21,8 +21,7 @@ class Top extends React.Component { constructor (props) { super(props) this.state = { - tree: null, - reloadTries: 10 + tree: null } } @@ -43,17 +42,11 @@ class Top extends React.Component { this.setState({ tree }) if (isFilteredToCommit) { - //When using the filter, the "Files changed" label on github still shows the total files changed - //so we just try to reload the tree a few times to make sure every file gets loaded - if(this.state.reloadTries > 0) { - this.setState({reloadTries: this.state.reloadTries-1}) - setTimeout(this.calculateTree.bind(this), 2000) - } return } if (fileCount !== count) { - setTimeout(this.calculateTree.bind(this), 1000) + setTimeout(this.calculateTree.bind(this), 100) } } From 0ebdeecb635afb7e121aee62456da42f97b30601 Mon Sep 17 00:00:00 2001 From: Linus045 Date: Mon, 30 Aug 2021 16:35:18 +0200 Subject: [PATCH 5/5] Replaced method.bind(this) with arrow function --- src/js/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/index.jsx b/src/js/index.jsx index f56f8c0..da98f77 100644 --- a/src/js/index.jsx +++ b/src/js/index.jsx @@ -55,7 +55,7 @@ class Top extends React.Component { if (!tree) { return null } - return + return this.loadTree()} /> } }