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
Remove projects from sidebar if there are no projects #1965
Conversation
|
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.
Great solution! It works already, however I'd like to see some caching, like in releases-tab.tsx
:
const repoKey = `hide-projects:${repoUrl}`;
Wouldn't that conflict with organization level projects. What I mean is that if we cache count for each repo and a project is added at organization level, the user might have to wait until the cache expires. Not saying its a bad idea, but thinking if there would be any problems, because releases is for a single repo, but projects work at both repo and organization level!? 🤔🤷♂️ |
That raises another question: is this piece of code correctly counting the projects in organizations as well? And also: do closed projects appear in the dropdown?
That's kinda the issue with all caches. The workaround would be to have a short cache (1 day) |
Alternatively, instead of hiding the Projects, we could condense the sidebar:
Related feature request to keep in mind: #421 |
Yup, the partially loaded DOM contains item listing for both repository and organization projects combined in their own containers. Here we are counting these combined projects (example).
Just tested it, no they don't. 🎉
I'll see what I can do with caching, might take time though. |
Already thought of generalizing this feature hide all the empty sidebar stuff, but stopped after looking at "Assignees", that looks like a useful thing to have even when it doesn't have anything to show, or maybe that's just me. Open to other thoughts too! 😉 (Edit: "Assignees" and "Labels" almost always exist, but "Projects" and "Milestones" might not) |
@sindresorhus agreed that this is the way to go,
And
This would reduce noise considerably on "empty" discussions like parcel-bundler/parcel#2840
Test on Parcel PRs too, they seem to use all features: https://github.com/parcel-bundler/parcel/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc |
This It should not depend on whether there are projects and milestones at all. Only if none are assigned. Refer to this, step by step: #1965 (comment) and the first screenshot here: #1965 (comment) |
Closes #977
Replaces and closes #1945
This features removes the projects section in the issue and PR sidebar if the user doesn't have any permissions or if there are no projects to select.