Skip to content

Commit

Permalink
🩹 Polyfill throwIfAborted (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
coyotte508 authored Nov 15, 2023
1 parent 0c568c7 commit d5184f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ jobs:
working-directory: e2e/ts
run: |
npm i -g yarn --force
# yarn now looks at root package.json for the package manager...
mv ../../package.json ../../package.json.bk
yarn install --registry http://localhost:4874/
mv ../../package.json.bk ../../package.json
- name: E2E test - typescript node project
working-directory: e2e/ts
Expand Down
9 changes: 9 additions & 0 deletions packages/hub/src/lib/commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ export async function* commitIter(params: CommitParams): AsyncGenerator<CommitPr
const abortController = new AbortController();
const abortSignal = abortController.signal;

// Polyfill see https://discuss.huggingface.co/t/why-cant-i-upload-a-parquet-file-to-my-dataset-error-o-throwifaborted-is-not-a-function/62245
if (!abortSignal.throwIfAborted) {
abortSignal.throwIfAborted = () => {
if (abortSignal.aborted) {
throw new DOMException("Aborted", "AbortError");
}
};
}

if (params.abortSignal) {
params.abortSignal.addEventListener("abort", () => abortController.abort());
}
Expand Down

0 comments on commit d5184f7

Please sign in to comment.