Skip to content

Commit

Permalink
chore: fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed May 3, 2022
1 parent 4d01f25 commit f494d80
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 1 addition & 5 deletions apps/demo/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ module.exports = withMDX({
// https://github.com/vercel/next.js/pull/7550#issuecomment-512861158
// https://github.com/vercel/next.js/issues/12861
exclude: [
/@next\/react-dev-overlay/,
/@next\/react-refresh-utils\/runtime.js$/,
/@next\/react-refresh-utils\/internal\/helpers.js$/,
/next\/dist\/build\/polyfills\/unfetch.js$/,
/next\/dist\/build\/polyfills\/unfetch.js$/,
/next/,
],
use: ['source-map-loader'],
enforce: 'pre',
Expand Down
1 change: 0 additions & 1 deletion apps/demo/src/components/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ function _Connect(): JSX.Element | null {
const disconnect = useCallback(async () => {
try {
await GlobalState.device!.close();
GlobalState.setDevice(undefined, undefined);

This comment has been minimized.

Copy link
@alexlabs

alexlabs May 19, 2022

after remove this , disconnect button does not responding any more.

This comment has been minimized.

Copy link
@yume-chan

yume-chan May 19, 2022

Author Owner

@alexlabs as I found in #419 (comment), this line

this._abortController.abort();

should trigger the pipe to reject

// https://github.com/MattiasBuelens/web-streams-polyfill/issues/115
// `e` is always `AbortError` (instead of what I give in `abortController.abort()`)
// so we can't check if `e` is a real error.
if (!this._closed) {
this._disconnected.reject(e);
}
this.dispose();

This means the callers only need to observe the disconnected promise, and this line is not necessary.

But now it doesn't work.

} catch (e: any) {
GlobalState.showErrorDialog(e);
}
Expand Down
4 changes: 4 additions & 0 deletions apps/demo/src/pages/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const state = makeAutoObservable({
});

autorun(() => {
if (!terminal) {
return;
}

if (!GlobalState.device) {
terminal.socket = undefined;
return;
Expand Down
7 changes: 7 additions & 0 deletions libraries/adb/src/adb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ export class Adb implements Closeable {
return framebuffer(this);
}

/**
* Close the ADB connection.
*
* Note that it won't close the streams from backends.
* The streams are both physically and logically intact,
* and can be reused.
*/
public async close(): Promise<void> {
await this.dispatcher.close();
}
Expand Down

1 comment on commit f494d80

@vercel
Copy link

@vercel vercel bot commented on f494d80 May 3, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ya-webadb – ./

ya-webadb-git-master-yume-chan.vercel.app
ya-webadb-yume-chan.vercel.app
ya-webadb.vercel.app

Please sign in to comment.