-
Notifications
You must be signed in to change notification settings - Fork 192
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
Parse Link header in issue model. #385
Conversation
So I ran the
Everything is working, but as you said because it's not used. It's difficult to know what it does in terms of requests. Looking at
receiving a JSON object which has 16 entries, and still no pagination links. I wonder when the pagination is starting. Any idea? |
GitHub only sends pagination links for resources which need paginating--I think by default that begins after 30 issues. (I had assumed they would always send it.) You should be able to request the issues of a popular repo like https://api.github.com/repos/jquery/jquery/issues. |
That's another way we can do it, but would require rewriting how we handle responses from the server for Issue Collections. Right now we assume we get back an array of Issue objects and render. Maybe I'll end up re-writing it when I start using the pagination links. |
Since there's no strong objections, I'm going to merge this so I can continue working towards the other issues. Thanks for the suggestion to parse the Link header via Python and send the parsed object in the response--I might end up doing that. |
Parse Link header in issue model.
(If I'm abusing reviews, let me know--I think this particular case is OK because it's sort of in flux and doesn't change any existing functionality). |
About the piece of code. I was asking what it was doing, but I didn't get the answer ;) Maybe I'm too polite in my questions.
but these same to be the same two requests. I might be missing something. So the fact to see that it should be done on the python side is that if there are two requests already it's better to grasp the information already. We want less dependencies on JS, not more. Specifically for things which are related to requests and API. As for the execution of the code. I'm a bit wary when we introduce codes without a way to test it. Be a test case or at least demo code for using it. About the review process hehe. kind of abusing.
|
Sorry, I did not understand that from:
It's OK to be less polite and be more direct in your questions. No hard feelings. As to the actual question,
If it's requesting again, that's a bug. The code that parses the Link header gets the Link header from the original jqXHR object (a jquery-fied XHR object) from the request to the /issues endpoint. Double checking just now there's only a single request to
Tests are on their way. ^_^
Again, sorry about screwing up the review process. It seemed like you were giving me a hint about how you would have done it, I didn't realize it was a question about the code at hand.
Well, it is being used internally in the IssueCollection. This PR introduced a The next step will be to use the |
Thanks @miketaylr for taking the time to explain.
That will take efforts. A lot. Because I have strong ideas of what should be done and not done. I'm always afraid to push too hard my own will. I want to preserve the nice part of the project: the collective collaboration. Back to the core:
Ah cool. I didn't know that.
So all these requests are going through webcompat (which is cool). OK let's be more affirmative. I think we should (must? ;) still too polite ) not do it through JS. But let me know if my logic is flawed:
Note that the JS code and python code could be associated here for a performance gain. During the first request we can imagine to prefetch the JSON (by webcompat.com) the next pages using the links in the HTTP headers). In that way when the user clicks on next/prev, the request doesn't go to github. It's already here in webcompat.com. |
Hehe. Your POV doesn't surprise me. I don't agree with it 100%, but I hope you'll keep sharing it.
Nope, that's correct. The server knows about the Links before the client.
👍 This would be a cool enhancement. But let's keep in mind that "next" can mean a lot of things. For issues, there are |
We don't use it yet, but this allows us to keep doing pagination the way we do--and will allow us to use Link URIs to request new pages.
r? @karlcow because it relates to HTTP-ish things.