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

Remove request and request-promise-native in favour of got #3974

Closed
wants to merge 1 commit into from

Conversation

Nokel81
Copy link
Collaborator

@Nokel81 Nokel81 commented Oct 6, 2021

Signed-off-by: Sebastian Malton [email protected]

fixes #459

@Nokel81 Nokel81 added the chore label Oct 6, 2021
@Nokel81 Nokel81 requested a review from ixrock October 6, 2021 19:07
@Nokel81 Nokel81 requested a review from a team as a code owner October 6, 2021 19:07
@Nokel81 Nokel81 requested review from jweak and removed request for a team October 6, 2021 19:07
Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

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

Why not node-fetch? (we are already using that)

@Nokel81
Copy link
Collaborator Author

Nokel81 commented Oct 6, 2021

Because I think that got's API is better.

ixrock
ixrock previously approved these changes Oct 7, 2021
Copy link
Contributor

@ixrock ixrock left a comment

Choose a reason for hiding this comment

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

LGTM


for (const detectorClass of this.registry) {
const detector = new detectorClass(cluster);
return [detector.key, await detector.detect()] as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

What means as const and why do we need it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions

It is the way to say that you want a tuple of distinct types instead of an array of the union of all possible types.

Comment on lines 62 to 54
return Object.fromEntries(
iter.map(
Object.entries(results),
([key, { value }]) => [key, value]
)
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need iter.map here? Is it different somehow from:

return Object.fromEntries(
  Object.entries(results).map(([key, { value }]) => [key, value])
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Doesn't allocate a new array. That is all (since fromEntries wants an iterable). I can change it if you would like.

src/renderer/components/+preferences/helm-charts.tsx Outdated Show resolved Hide resolved
@ixrock
Copy link
Contributor

ixrock commented Oct 7, 2021

Why not node-fetch? (we are already using that)

Good point btw. Or just use window.fetch in renderer + just fetch is available in service-workers.
As far as I remember main limitation for browser's Fetch API that it's limited to 4 requests per host, right? But in most cases we could use fetch or node-fetch everywhere. Wdyt?

@jakolehm
Copy link
Contributor

jakolehm commented Oct 7, 2021

Because I think that got's API is better.

@Nokel81 I meant that we are using node-fetch extensively in our JsonApi/KubeApi. If that's not good enough then we probably should consider replacing that also (it would cause breaking change).

https://github.com/lensapp/lens/blob/master/src/common/k8s-api/json-api.ts#L25

@jakolehm
Copy link
Contributor

jakolehm commented Oct 7, 2021

Good point btw. Or just use window.fetch in renderer + just fetch is available in service-workers.
As far as I remember main limitation for browser's Fetch API that it's limited to 4 requests per host, right? But in most cases we could use fetch or node-fetch everywhere. Wdyt?

We are already using node-fetch on both main & renderer because of browser fetch limitations 🙂

@Nokel81
Copy link
Collaborator Author

Nokel81 commented Oct 7, 2021

@jakolehm Here is a comparison between the two (yes I admit it is from the GOT side) https://github.com/sindresorhus/got#comparison

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2021

Conflicts have been resolved. A maintainer will review the pull request shortly.

@jakolehm
Copy link
Contributor

jakolehm commented Oct 8, 2021

@jakolehm Here is a comparison between the two (yes I admit it is from the GOT side) https://github.com/sindresorhus/got#comparison

I have been using got in other projects and it's fine choice but does not really warrant yet-another library included if we already have node-fetch. I'm fine with this PR because it removes deprecated request library (although just partially, kubernetes javascript client still uses it) -> we can change got -> node-fetch in follow-up if that feels better. Bottom line: less deps is better.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2021

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@Nokel81 Nokel81 force-pushed the issue-459 branch 2 times, most recently from 16143f7 to e0f66e6 Compare December 17, 2021 18:04
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2022

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@Nokel81
Copy link
Collaborator Author

Nokel81 commented Feb 15, 2022

I am going to close this PR, instead move to node-fetch. Since according to kubernetes-client/javascript#754 that is what kubernetes/client-javascript will be doing as well.

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

Successfully merging this pull request may close these issues.

Get rid of "request" and "request-promise-native" (deprecation notice)
3 participants