Skip to content

Conversation

@minkimcello
Copy link
Contributor

WIP

Motivation

Approach

Alternate Designs

Possible Drawbacks or Risks

TODOs and Open Questions

Learning

Screenshots

@netlify
Copy link

netlify bot commented Feb 13, 2024

👷 Deploy request for frontside pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2463ade

const response = yield* call(fetch("https://foo.bar"), { signal });

if (response.ok) {
return yield* call(response.json());
Copy link
Member

Choose a reason for hiding this comment

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

Let's use call(() => response.jon()) here instead of call(response.json). We're probably going to change this upstream, so just to make it forward compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
}

main(function* () {
Copy link
Member

Choose a reason for hiding this comment

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

Let's use run in the example here because main is only for scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one's done too

let attempt = -1;
while (true) {
const signal = yield* useAbortSignal();
const response = yield* call(fetch("https://foo.bar"), { signal });
Copy link
Member

Choose a reason for hiding this comment

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

We should take take argument from fetchWithBackoff.

function* fetchWithBackoff(url: URL | string, init?: RequestInit) {
    const signal = yield* useAbortSignal();
    const response = yield* call(() => fetch(url, { ...init, signal }));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the arguments for all the examples except the last one. If we're surfacing the function to the top, those don't need to be an argument, right?

@taras
Copy link
Member

taras commented Feb 13, 2024

Looks good. Should we start working on the text now?

@minkimcello
Copy link
Contributor Author

Looks good. Should we start working on the text now?

👌

@minkimcello
Copy link
Contributor Author

@taras I might need some help with the intro and outro. And let me know what you think of the draft.

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.

2 participants