Skip to content

Restore forked-to feature and enable it for every user - #5597

Merged
cheap-glitch merged 3 commits into
mainfrom
fix-forked-to
Apr 21, 2022
Merged

cheap-glitch merged 3 commits into
mainfrom
fix-forked-to

Conversation

@cheap-glitch

Copy link
Copy Markdown
Contributor

Fixes #5596

Test URLs

Fork a repo 🍴

Screenshot

image

@cheap-glitch
cheap-glitch marked this pull request as ready for review April 14, 2022 11:00

@cheap-glitch cheap-glitch left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@refined-github/maintainers Could someone who's in several organizations test this with multiple forks? Thanks 💟

Comment thread source/features/forked-to.tsx Outdated
Comment on lines +126 to +120
const hasOrganizations = await elementReady('details-dialog[src*="/fork"]', {waitForChildren: false});
const hasOrganizations = select.exists('[data-ga-click*="show fork modal"]');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This targets an attribute on the "Fork" button itself, so we shouldn't need the elementReady. Not sure if this is really limited to people in organizations though.

Comment thread source/features/forked-to.tsx Resolved
@fregante

Copy link
Copy Markdown
Member

GitHub really broke the flow here and I expect them to change this once again soon.

The fork button now always points to the new /fork page, even if I have a fork.

Big deal breaker: there is NO link to my existing fork. At least I don't see it.

forked-to just became mandatory for every GitHub user. 😃

@fregante

Copy link
Copy Markdown
Member

Separately perhaps I'd also replace the ?fragment fetch with an API call because that fragment is no longer shown on GitHub and I expect them to drop it soon (unless they restore it)

@cheap-glitch cheap-glitch changed the title Fix forked-to feature Restore forked-to feature Apr 14, 2022
@cheap-glitch cheap-glitch changed the title Restore forked-to feature Restore forked-to feature and enable it for every user Apr 14, 2022
@fregante

Copy link
Copy Markdown
Member

I suppose this will also close #5435

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

I suppose this will also close #5435

I don't know, I've never seen this error in the first place

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge and release a new version today

// Only fetch/update forks when we see a fork (on the current page or in the cache).
// This avoids having to `updateCache` for every single repo you visit.
if (forks || (hasOrganizations && pageDetect.isForkedRepo())) {
if (forks || pageDetect.isForkedRepo()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you flip this condition to allow an early return? I think

Suggested change
if (forks || pageDetect.isForkedRepo()) {
if (!forks && !pageDetect.isForkedRepo()) {
return false;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about it too but in this case, since the first block is only one line long, I think it just makes the logic less clear while providing no benefits at runtime.

@cheap-glitch
cheap-glitch merged commit 8fa06cb into main Apr 21, 2022
@cheap-glitch
cheap-glitch deleted the fix-forked-to branch April 21, 2022 11:25
@kidonng

kidonng commented Jun 29, 2022 •

Copy link
Copy Markdown
Member

GitHub really broke the flow here and I expect them to change this once again soon.

The repository fork button now displays existing forks.

AND THEY MENTIONED REFINED GITHUB

Is this @fregante's work? Impressive 🎉

@fregante

Copy link
Copy Markdown
Member

Called it!

Screen Shot 8

Is this @fregante's work? Impressive 🎉

Screen Shot

First requested in #1129 and implemented in #2153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

forked-to seems broken

3 participants