-
Notifications
You must be signed in to change notification settings - Fork 1
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
Docs: Various fixes in "Mid run cancellation" section #235
Conversation
`signal` does not need to be checked, since `fetch` will reject.
✅ Deploy Preview for sheepdog ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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(); |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 !
commit: |
An
AbortSignal
does not need to be checked after thefetch
using it, sincefetch
will reject onabort
.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.)