#168
See if you have a fork of a repo
It would be nice to have some indicator in the fork button, if you have a fork of the current repo your viewing.
It would be nice to have some indicator in the fork button, if you have a fork of the current repo your viewing.
The fork control is in
apps/dashboard/src/components/repo/repo-star-fork-actions.tsxalongside the star button. Stars already reflect the signed-in user viaviewerHasStarredonRepoOverview(filled with optimistic updates in that component); the fork side only shows the public fork count and always reads “Fork”, so that’s the obvious place to add a second visual state once you have data.RepoOverviewandviewerHasStarredare defined inapps/dashboard/src/lib/github.types.ts. The overview payload is assembled ingetRepoOverviewinapps/dashboard/src/lib/github.functions.ts: the main GraphQL query (repo.overview.v2) does not carry viewer-specific fork info today, butviewerHasStarredis merged in afterward byresolveViewerHasStarredForRepo. That helper intentionally uses the user GitHub client (OAuth / user-to-server), not the installation token, because installation-scoped queries don’t match what the person in the browser sees—see the comment above that function. Any “you already have a fork” flag should follow the same pattern so the indicator stays accurate.Detecting an existing fork will need a small dedicated fetch (similar to that resolver): e.g. a REST
GETfor the viewer’s repo with the same name and verifyfork+parentpoints at this repo when forks keep the default name, or a forks/list/search path if you need renamed forks. After forking,forkRepositoryalready navigates to the new repo—you may also want to invalidate or patch the repo overview query cache so the new state shows up without a full reload.Related history: fork/star in the header landed in #151; the original fork request was #107.