From 367d8a61780b3ecf013e4c21c6cb7e9daf782a30 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 10 Jun 2020 20:21:15 -0500 Subject: [PATCH] remove buffers.expanding() according to the docs, this is the default --- src/sagas/lwp3-bootloader.ts | 12 +++++------- src/sagas/terminal.ts | 9 ++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/sagas/lwp3-bootloader.ts b/src/sagas/lwp3-bootloader.ts index f359628d..35c4657b 100644 --- a/src/sagas/lwp3-bootloader.ts +++ b/src/sagas/lwp3-bootloader.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2020 The Pybricks Authors -import { Channel, buffers } from 'redux-saga'; +import { Channel } from 'redux-saga'; import { actionChannel, fork, put, take, takeEvery } from 'redux-saga/effects'; import { Action } from '../actions'; import { @@ -51,12 +51,10 @@ import { hex } from '../utils'; function* encodeRequest(): Generator { // Using a while loop to serialize sending data to avoid "busy" errors. - const chan = (yield actionChannel( - (a: Action) => - Object.values(BootloaderRequestActionType).includes( - a.type as BootloaderRequestActionType, - ), - buffers.expanding(), + const chan = (yield actionChannel((a: Action) => + Object.values(BootloaderRequestActionType).includes( + a.type as BootloaderRequestActionType, + ), )) as Channel; while (true) { const action = (yield take(chan)) as BootloaderRequestAction; diff --git a/src/sagas/terminal.ts b/src/sagas/terminal.ts index 14898304..3a292f07 100644 --- a/src/sagas/terminal.ts +++ b/src/sagas/terminal.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2020 The Pybricks Authors -import { Channel, buffers } from 'redux-saga'; +import { Channel } from 'redux-saga'; import { actionChannel, delay, @@ -24,10 +24,9 @@ const encoder = new TextEncoder(); const terminalDataSource = new PushStream(); function* receiveTerminalData(): Generator { - const channel = (yield actionChannel( - TerminalActionType.ReceivedData, - buffers.expanding(), - )) as Channel; + const channel = (yield actionChannel(TerminalActionType.ReceivedData)) as Channel< + TerminalDataReceiveDataAction + >; while (true) { // wait for input from terminal const action = (yield take(channel)) as TerminalDataReceiveDataAction;