-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat: use meta.json to request smarter & fix wrong initialization timings of features #717
Conversation
now they run expectedly in the both old and new UI
1ffe41d
to
71b1f48
Compare
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.
Hi @wxharry, this PR is ready, would you mind testing it then merging it if everything works fine in the both UI?
|
||
export function hasRepoContainerHeader() { | ||
const headerElement = $('#repository-container-header'); | ||
return headerElement && !headerElement.attr('hidden'); | ||
} | ||
|
||
export async function isRepoRoot() { | ||
return pageDetect.isRepoRoot(); | ||
} | ||
|
||
/** | ||
* check if the repository is public | ||
*/ | ||
export async function isPublicRepo() { | ||
const selector = 'meta[name="octolytics-dimension-repository_public"]'; | ||
await elementReady(selector); | ||
// <meta name="octolytics-dimension-repository_public" content="true/false"> | ||
const isPublic = $(selector).attr('content') === 'true'; | ||
return pageDetect.isRepo() && isPublic; | ||
} |
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.
This three checkers will work in both the old and the new UI.
(await elementReady('#repository-container-header'))?.append(container); | ||
(await elementReady('nav.js-repo-nav'))?.append(container); |
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.
and this selector also works in the both UI.
lastDataAvailableMonth
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.
LGTM. Thanks!
/approve |
Brief Information
This pull request is in the type of (more info about types):
Related issues (all available keywords):
Details
In this PR, meta.json is introduced to decrease invalid network requests and to decide
lastDataAvailableMonth
.meta.json examples:
Checklist
Others