Skip to content
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

Merged
merged 6 commits into from
Aug 23, 2023

Conversation

tyn1998
Copy link
Member

@tyn1998 tyn1998 commented Aug 13, 2023

Brief Information

This pull request is in the type of (more info about types):

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • test

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

@tyn1998 tyn1998 requested review from l1tok and wxharry August 13, 2023 10:06
@tyn1998 tyn1998 marked this pull request as draft August 17, 2023 05:52
now they run expectedly in the both old and new UI
@tyn1998 tyn1998 marked this pull request as ready for review August 21, 2023 16:50
Copy link
Member Author

@tyn1998 tyn1998 left a 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?

Comment on lines +10 to +29

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;
}
Copy link
Member Author

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.

Comment on lines -56 to +64
(await elementReady('#repository-container-header'))?.append(container);
(await elementReady('nav.js-repo-nav'))?.append(container);
Copy link
Member Author

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.

@tyn1998 tyn1998 changed the title feat: use meta.json to decrease invalid network requests and to decide lastDataAvailableMonth feat: use meta.json to request smarter & fix wrong initialization timings of features Aug 21, 2023
@menbotics menbotics bot added the kind/feature Category issues or prs related to feature request. label Aug 21, 2023
Copy link
Collaborator

@wxharry wxharry left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@wxharry
Copy link
Collaborator

wxharry commented Aug 23, 2023

/approve

@menbotics menbotics bot added the pull/approved If a pull is approved, it will be automatically merged label Aug 23, 2023
@menbotics menbotics bot merged commit c5e418f into hypertrons:master Aug 23, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Category issues or prs related to feature request. pull/approved If a pull is approved, it will be automatically merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] OSS-GPT only shows on Code tab [Feature] to use meta.json to decrease invalid network requests
2 participants