-
Notifications
You must be signed in to change notification settings - Fork 133
Fix bug: table update error while using file view #53
base: master
Are you sure you want to change the base?
Conversation
Merging with latest changes
The extension tried to update file sizes even when a directory page was not being browsed, which led to error `TypeError: tree.forEach is not a function` on line 153 (line number before this commit) For example, visit page: https://github.com/harshjv/github-repo-size/blob/master/src/inject.js and check extension errors This is now fixed by detecting directory view with the presence of the 'Add file' button and updating table only if the button is present. Also, removed redundant CSS 'cursor: pointer' for newLiElem.
This reverts commit c998132. Undoing bugfix because file sizes on repo main page are broken
The extension tried to update file sizes even when a directory page was not being browsed, which led to error `TypeError: tree.forEach is not a function` on line 153 (line number before this commit) For example, visit page: https://github.com/harshjv/github-repo-size/blob/master/src/inject.js and check extension errors This is now fixed by detecting directory view with the presence of the 'Add file' button and updating table only if the button is present. Also, removed redundant CSS 'cursor: pointer' for newLiElem.
Now using distinct classes for directory view detection as requested here: harshjv#53 (comment) We will now detect the presence of rows in the files list box instead of using the 'Add file' button Removed copied attributes from 'Settings' nav-item because it caused GitHub's native JS to throw errors in repos where the 'Settings' button is not present. Updated CSS classes and width for SVG icon
@msvamp thank you for the update! Can you please share steps to reproduce |
Sure. The steps are pretty simple. Steps to reproduce
Steps to reproduce (alternate)Alternately, the same error is also visible in the console section of the Developer Tools on visiting the same page. What causes the error?When a request is made to GitHub API for a directory in a repo or the root of the repo, the response contains the corresponding details of all files in the folder in the the form of an array of JSON objects. Example request: But when a request is made for a file in a repo, the response contains a single JSON object with the details of the single file, and hence the Example request: |
The extension tried to update file sizes even when a directory page was not being browsed, which led to error
TypeError: tree.forEach is not a function
on line 153 (line number before this pull request)For example, visit page: https://github.com/harshjv/github-repo-size/blob/master/src/inject.js and check extension errors.
This is now fixed by detecting directory view with the presence of the 'Add file' button and updating table only if the button is present.
Also, removed redundant CSS
'cursor: pointer'
for newLiElem.