Skip to content

Use yetch and support AbortController - #112

Merged
stefanpenner merged 1 commit into
ember-cli:masterfrom
tchak:yetch
May 14, 2018
Merged

Use yetch and support AbortController#112
stefanpenner merged 1 commit into
ember-cli:masterfrom
tchak:yetch

Conversation

@tchak

@tchak tchak commented May 13, 2018

Copy link
Copy Markdown
Collaborator

This is an attempt at #111

@stefanpenner

stefanpenner commented May 14, 2018

Copy link
Copy Markdown
Collaborator

Just noting some stuff, just doing diligence.

yetch: 3,169 (gzipd)
whatwg-fetch: 2,904 (gzipd)

Size difference basically doesn't matter. Getting abort control well justifies that.


I skimmed the code for yetch it also appears good.


I pinged @jayphelps (one of the yetch maintainers) just to see if he had any thoughts/concerns for us.

Comment thread public/fastboot-fetch.js
self['Headers'] = fetch.Headers;
self['Request'] = fetch.Request;
self['Response'] = fetch.Response;
var AbortControllerPolyfill = FastBoot.require('abortcontroller-polyfill/dist/cjs-ponyfill');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need our Fastboot users to also additionally import/require the abortcontroller polyfil, or does this happen automagically? If so, can you briefly explain how?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Just like with browser implementation :

import fetch, { AbortController } from 'fetch';

I will add a paragraph to README to clarify

@stefanpenner

Copy link
Copy Markdown
Collaborator

cc @nlfurniss

@stefanpenner

stefanpenner commented May 14, 2018

Copy link
Copy Markdown
Collaborator

@tchak have you confirmed all the abort-controller stuff works correctly with node-fetch as well? I don't actually see support for signal within node-fetch's code-base.

@jayphelps

Copy link
Copy Markdown
Member

@stefanpenner @tchak yep node-fetch does not appear to support abort signals yet node-fetch/node-fetch#437

@stefanpenner

Copy link
Copy Markdown
Collaborator

@tchak I'm unsure if we should go down this path, until node-fetch supports signals. Thoughts?

@tchak

tchak commented May 14, 2018

Copy link
Copy Markdown
Collaborator Author

@stefanpenner

Copy link
Copy Markdown
Collaborator

@tchak ah, thank-you. This lgtm.

@stefanpenner
stefanpenner merged commit 3ab7ddd into ember-cli:master May 14, 2018
@stefanpenner

Copy link
Copy Markdown
Collaborator

released as v4.0.1 🎉

Comment thread index.js

var fetch = normalizeFileName(find(expandedFetchPath));
var expandedFetchPath = expand(fetchPath, 'dist/yetch-polyfill.js');
var expandedAbortcontrollerPath = expand(abortcontrollerPath, 'abortcontroller-polyfill-only.js');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

abortcontroller-polyfill-only.js doesn't have abortableFetch which means we can't do
fetch(Request("http://api.github.com", {signal}))

The test in this PR only tested controller is polyfilled but not abortable fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants