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

fix: Typing for WritableStream #1186

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/iris-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
"prop-types": "^15.7.2",
"react-beautiful-dnd": "^13.1.0",
"react-transition-group": "^4.4.2",
"shortid": "^2.2.16",
"web-streams-polyfill": "^2.1.0"
"shortid": "^2.2.16"
},
"peerDependencies": {
"react": "^17.x",
Expand Down
13 changes: 1 addition & 12 deletions packages/iris-grid/src/sidebar/TableSaver.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PureComponent } from 'react';
import { WritableStream as ponyfillWritableStream } from 'web-streams-polyfill/ponyfill';
import dh, {
Column,
DateWrapper,
Expand All @@ -10,7 +9,6 @@ import dh, {
} from '@deephaven/jsapi-shim';
import Log from '@deephaven/log';
import { GridRange, GridRangeIndex, memoizeClear } from '@deephaven/grid';

import { Formatter, FormatterUtils, TableUtils } from '@deephaven/jsapi-utils';
import {
CancelablePromise,
Expand Down Expand Up @@ -97,9 +95,6 @@ export default class TableSaver extends PureComponent<
this.snapshotPending = 0;
this.cancelableSnapshots = [];

// WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead
this.WritableStream = window.WritableStream ?? ponyfillWritableStream;

// Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.
// Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.
// If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.
Expand Down Expand Up @@ -175,12 +170,6 @@ export default class TableSaver extends PureComponent<

cancelableSnapshots: (CancelablePromise<unknown> | null)[];

// WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead

// TODO: Fix type error
WritableStream = window.WritableStream ?? ponyfillWritableStream;
// WritableStream: typeof window.WritableStream | typeof ponyfillWritableStream;

// Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.
// Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.
// If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.
Expand Down Expand Up @@ -257,7 +246,7 @@ export default class TableSaver extends PureComponent<
};
}

return new this.WritableStream(streamConfig);
return new WritableStream(streamConfig);
}

startDownload(
Expand Down