chore: fix build warnings

This commit is contained in:
Simon Chan 2022-05-03 11:43:46 +08:00
parent 4d01f25124
commit f494d80166
4 changed files with 12 additions and 6 deletions

View file

@ -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',

View file

@ -203,7 +203,6 @@ function _Connect(): JSX.Element | null {
const disconnect = useCallback(async () => {
try {
await GlobalState.device!.close();
GlobalState.setDevice(undefined, undefined);
} catch (e: any) {
GlobalState.showErrorDialog(e);
}

View file

@ -39,6 +39,10 @@ const state = makeAutoObservable({
});
autorun(() => {
if (!terminal) {
return;
}
if (!GlobalState.device) {
terminal.socket = undefined;
return;

View file

@ -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();
}