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

Add suggestions drop-down to search box #5

Open
ISNIT0 opened this issue Jun 14, 2019 · 3 comments
Open

Add suggestions drop-down to search box #5

ISNIT0 opened this issue Jun 14, 2019 · 3 comments
Labels

Comments

@ISNIT0
Copy link

ISNIT0 commented Jun 14, 2019

No description provided.

@nwtgck
Copy link
Owner

nwtgck commented Jun 14, 2019

@ISNIT0
Thank you very much for your idea!
The search box is a very helpful feature for users because they use it even if they forget some part of repo name.

However, search in GitHub API is very limited to request, 30req/min. So, I think it is not a realistic way to implement in current status. If this app is OAuth app and has user's tokens, this feature may be realistic, I think.

@ISNIT0
Copy link
Author

ISNIT0 commented Jun 14, 2019

I think you might be able to use this: https://developer.github.com/v3/repos/#list-user-repositories
(Probably in conjunction with the org request too)...

E.g. this works without a key: https://api.github.com/users/nwtgck/repos

// debounced...
if(term.includes('/')) {
    const [userOrOrg] = term.split('/');
    const resultsArr = await Promise.all([
        fetch(`https://api.github.com/users/${userOrOrg}/repos`).then(a => a.json()),
        fetch(`https://api.github.com/orgs/${userOrOrg}/repos`).then(a => a.json())
    ])
    const results = resultsArr.flat();

    search.suggest(results);
}

@nwtgck
Copy link
Owner

nwtgck commented Jun 14, 2019

@ISNIT0 You are right! I was wrong.

The search feature can be done on the client side! It doesn't consume the rate-limit of server-side at all. This feature is very realistic. I'd like to have this feature in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants