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

Docs: Various fixes in "Mid run cancellation" section #235

Merged

Conversation

brunnerh
Copy link
Contributor

@brunnerh brunnerh commented Nov 23, 2024

An AbortSignal does not need to be checked after the fetch using it, since fetch will reject on abort.

I initially thought that removing the check would be enough, but the following sections build on this example which makes the generator approach redundant for such a simple case. Will add further comments marking the sections.

Lowercase after colons is a more British English style. I changed it here to what apparently is more commonly seen in American English (did not know that there was this distinction beforehand). This should probably either be applied elsewhere for consistency or be reverted again.

(If this document was auto-formatted, that would probably need to be re-applied.)

`signal` does not need to be checked, since `fetch` will reject.
Copy link

netlify bot commented Nov 23, 2024

Deploy Preview for sheepdog ready!

Name Link
🔨 Latest commit d8879dd
🔍 Latest deploy log https://app.netlify.com/sites/sheepdog/deploys/6741823fd770d700080ba9d1
😎 Deploy Preview https://deploy-preview-235--sheepdog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 276 to 278
const response = await fetch('/api/very-long-list', { signal });
// this line will never be executed if the task is canceled before fetch ends
list = await response.json();
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 is already the case because of the signal.
Should this be adjusted?

a way to stop executing and return something to the caller and the caller has a way to communicate
something back.

`@sheepdog/svelte` has been built to be able to accept an async generator function and, most
importantly, has been built to make the generator function work basically like a normal async
function if you change `await` with `yield`. Let's take a look
function if you replace `await` with `yield`. Let's take a look

<Tabs>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The following tabs section also has this simple example where the signal already does all the work.

Copy link
Collaborator

@paoloricciuti paoloricciuti left a comment

Choose a reason for hiding this comment

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

Oh my gosh so many typos! Thanks @brunnerh !

Copy link

pkg-pr-new bot commented Nov 28, 2024

npm i https://pkg.pr.new/@sheepdog/svelte@235

commit: d8879dd

@paoloricciuti paoloricciuti merged commit 79dac21 into mainmatter:main Nov 28, 2024
7 of 8 checks passed
@github-actions github-actions bot mentioned this pull request Nov 28, 2024
@beerinho beerinho added the documentation Improvements or additions to documentation label Dec 6, 2024
@paoloricciuti paoloricciuti added documentation Improvements or additions to documentation internal and removed documentation Improvements or additions to documentation labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants