pvcnt / mergeable

A better inbox for GitHub pull requests
https://mergeable.pages.dev
MIT License
12 stars 3 forks source link

fix: Handle multiple connections correctly on dashboard #13

Closed glossawy closed 5 months ago

glossawy commented 5 months ago

react-query's built-in memoization was causing connections to the same domain to clobber each other. You would have a race condition on which set of data gets shown and it would show up twice.

The goal here is to allow multiple connections to be used and have the sum of all of their PR requests be shown in the dashboard. Since we are already storing the key plain in localStorage I don't immediately see an issue with utilizing the token as part of the react query key.

Though technically it does expose the access token to more libraries. If that's a concern we could hash the token.

pvcnt commented 5 months ago

I had not considered this use case. Out of curiosity, how do you use multiple connections to the same host? How would they be configured differently?

glossawy commented 5 months ago

I provide an example in #12 but with github finer-grained tokens you grant access to a specific user/org, giving access to a user does not mean it will show all the repositories they have access to in all their orgs. So I had to create two different tokens one for the org and one for myself.

Basically the only difference is the token used for the connection.

pvcnt commented 5 months ago

That makes sense!