-
Notifications
You must be signed in to change notification settings - Fork 323
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 history panel not rendering when history is empty #1215
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and congrats for your first PR.
There is still an issue when you
- open an existing git repository
- open the history tab for that repository
- open a folder outside of any git repository
- make the folder a git repository through the extension (you can do that by selected the folder in the file browser, then go to the git extension panel and press the Initialize repo button)
- open the history for that new repository
- You should see the history for the other repository
The error seen in the console is
The fix for that would be to catch the error when calling log
in model.ts
to return a empty list of commits.
https://github.com/jupyterlab/jupyterlab-git/blob/master/src/model.ts#L917
Let me know if you need more pointers
src/model.ts
Outdated
} | ||
); | ||
} catch (error) { | ||
return { code: 0, commits: [] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the code in the panel is:
jupyterlab-git/src/components/GitPanel.tsx
Lines 264 to 270 in c7e7363
let pastCommits = new Array<Git.ISingleCommitInfo>(); | |
if (logData.code === 0) { | |
pastCommits = logData.commits; | |
} | |
this.setState({ | |
pastCommits: pastCommits |
The best is to return a non-null code (1
e.g) and the state will be an empty array as wanted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed this change! Thanks for the guidance @fcollonval!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot
Could you confirm me you work with @shawnesquivel? If yes, I will add him as co-author.
Yes @shawnesquivel and I both worked on the initial fix, but he wasn't able to submit the PR due to an issue with running the pre-commit hook, so I ended up submitting it. |
a6d489e
to
7df3391
Compare
catch error to handle the log return when there are no past commits in the current branch prettify and format correctly change handled return to simply a non-null, non-zero code rather than 0 with an empty list of commits Rebases to include changes from #13645 Update Playwright Snapshots Updates selection to selectionBackground, docs Update Playwright Snapshots Add renderer Fix UI test locator Fix linter Update Playwright Snapshots Buffer message while waiting for the terminal Update Playwright Snapshots Co-authored-by: Shawn Esquivel <[email protected]>
7df3391
to
5960aca
Compare
@all-contributors please add @basokant for code |
I've put up a pull request to add @basokant! 🎉 |
@all-contributors please add @shawnesquivel for code |
I've put up a pull request to add @shawnesquivel! 🎉 |
Provides fix for #1088
Freshly initialized repository after changes: