From fee58d398a0739296440e95a55c09996dc3f3013 Mon Sep 17 00:00:00 2001 From: Will O'Beirne Date: Thu, 16 Dec 2021 01:26:19 -0600 Subject: [PATCH] Fix takeEverys not yielding with babel macro for typed-redux-sagas --- package.json | 2 +- src/app/modules/account/sagas.ts | 2 +- src/app/modules/channels/sagas.ts | 2 +- src/app/modules/crypto/sagas.ts | 2 +- src/app/modules/node/sagas.ts | 2 +- src/app/modules/onchain/sagas.ts | 2 +- src/app/modules/payment/sagas.ts | 2 +- src/app/modules/peers/sagas.ts | 2 +- src/app/modules/rates/sagas.ts | 2 +- src/app/modules/sign/sagas.ts | 2 +- src/app/modules/sync/sagas.ts | 4 ++-- webpack.config.js | 1 + yarn.lock | 18 +++++++++++------- 13 files changed, 24 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 9e5b6c80..a2ceb875 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "antd": "^3.26.12", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.3", + "babel-plugin-macros": "^3.1.0", "babel-plugin-module-resolver": "^4.0.0", "bn.js": "^5.1.3", "buffer": "^6.0.3", @@ -78,7 +79,6 @@ "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "redux": "^4.0.5", - "redux-devtools-extension": "^2.13.2", "redux-logger": "^3.0.6", "redux-saga": "^1.1.3", "semver": "^7.3.2", diff --git a/src/app/modules/account/sagas.ts b/src/app/modules/account/sagas.ts index 286eb9b3..a550e641 100644 --- a/src/app/modules/account/sagas.ts +++ b/src/app/modules/account/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, select, call, all, put } from 'typed-redux-saga'; +import { takeLatest, select, call, all, put } from 'typed-redux-saga/macro'; import BN from 'bn.js'; import { selectNodeLibOrThrow } from 'modules/node/selectors'; import { getNodePubKey } from 'modules/node/sagas'; diff --git a/src/app/modules/channels/sagas.ts b/src/app/modules/channels/sagas.ts index 8315962d..482fce1b 100644 --- a/src/app/modules/channels/sagas.ts +++ b/src/app/modules/channels/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, select, call, all, put } from 'typed-redux-saga'; +import { takeLatest, select, call, all, put } from 'typed-redux-saga/macro'; import { selectNodeLibOrThrow } from 'modules/node/selectors'; import { requirePassword } from 'modules/crypto/sagas'; import { safeGetNodeInfo, safeConnectPeer, sleep } from 'utils/misc'; diff --git a/src/app/modules/crypto/sagas.ts b/src/app/modules/crypto/sagas.ts index 68cf4346..155b5aff 100755 --- a/src/app/modules/crypto/sagas.ts +++ b/src/app/modules/crypto/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, put, select, take, call } from 'typed-redux-saga'; +import { takeLatest, put, select, take, call } from 'typed-redux-saga/macro'; import { encryptData, TEST_CIPHER_DATA } from 'utils/crypto'; import { getPasswordCache, setPasswordCache } from 'utils/background'; import { syncTypes } from 'modules/sync'; diff --git a/src/app/modules/node/sagas.ts b/src/app/modules/node/sagas.ts index 70c74f01..056b8819 100644 --- a/src/app/modules/node/sagas.ts +++ b/src/app/modules/node/sagas.ts @@ -1,4 +1,4 @@ -import { take, takeLatest, call, put, select, all } from 'typed-redux-saga'; +import { take, takeLatest, call, put, select, all } from 'typed-redux-saga/macro'; import * as actions from './actions'; import { selectNodeLibOrThrow, diff --git a/src/app/modules/onchain/sagas.ts b/src/app/modules/onchain/sagas.ts index e50ad1f8..76a2bc0f 100644 --- a/src/app/modules/onchain/sagas.ts +++ b/src/app/modules/onchain/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, select, call, put } from 'typed-redux-saga'; +import { takeLatest, select, call, put } from 'typed-redux-saga/macro'; import { selectNodeLibOrThrow } from 'modules/node/selectors'; import types from './types'; diff --git a/src/app/modules/payment/sagas.ts b/src/app/modules/payment/sagas.ts index c7de53e9..999548a0 100644 --- a/src/app/modules/payment/sagas.ts +++ b/src/app/modules/payment/sagas.ts @@ -1,4 +1,4 @@ -import { takeEvery, call, select, put } from 'typed-redux-saga'; +import { takeEvery, call, select, put } from 'typed-redux-saga/macro'; import { selectNodeLibOrThrow, selectNodeInfo, diff --git a/src/app/modules/peers/sagas.ts b/src/app/modules/peers/sagas.ts index 5c04f08f..77265268 100644 --- a/src/app/modules/peers/sagas.ts +++ b/src/app/modules/peers/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, select, call, all, put } from 'typed-redux-saga'; +import { takeLatest, select, call, all, put } from 'typed-redux-saga/macro'; import { selectNodeLibOrThrow } from 'modules/node/selectors'; import { requirePassword } from 'modules/crypto/sagas'; import { safeGetNodeInfo, safeConnectPeer } from 'utils/misc'; diff --git a/src/app/modules/rates/sagas.ts b/src/app/modules/rates/sagas.ts index 4e1a8134..dddd90fa 100644 --- a/src/app/modules/rates/sagas.ts +++ b/src/app/modules/rates/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, call, put } from 'typed-redux-saga'; +import { takeLatest, call, put } from 'typed-redux-saga/macro'; import { CHAIN_TYPE, Fiat } from 'utils/constants'; import { fetchRates } from './actions'; import { apiFetchRates } from 'lib/cryptocompare'; diff --git a/src/app/modules/sign/sagas.ts b/src/app/modules/sign/sagas.ts index a62130d0..a64eac7a 100644 --- a/src/app/modules/sign/sagas.ts +++ b/src/app/modules/sign/sagas.ts @@ -1,4 +1,4 @@ -import { takeLatest, select, call, put } from 'typed-redux-saga'; +import { takeLatest, select, call, put } from 'typed-redux-saga/macro'; import { SignMessageResponse as WebLNSignMessageResponse } from 'webln'; import { selectNodeLibOrThrow } from 'modules/node/selectors'; import { requirePassword } from 'modules/crypto/sagas'; diff --git a/src/app/modules/sync/sagas.ts b/src/app/modules/sync/sagas.ts index 59987927..c3910540 100755 --- a/src/app/modules/sync/sagas.ts +++ b/src/app/modules/sync/sagas.ts @@ -7,7 +7,7 @@ import { take, fork, delay, -} from 'typed-redux-saga'; +} from 'typed-redux-saga/macro'; import { browser } from 'webextension-polyfill-ts'; import { selectSalt, @@ -102,7 +102,7 @@ export function* decryptSyncedData(syncConfig: SyncConfig, data: any) { yield put({ type: types.FINISH_DECRYPT }); } -export default function* cryptoSagas() { +export default function* syncSagas() { yield takeEvery(types.CLEAR_DATA, clearData); // First fetch sync'd data and hydrate the store diff --git a/webpack.config.js b/webpack.config.js index 1b7077bc..518ecd3a 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -109,6 +109,7 @@ module.exports = { loader: 'babel-loader', options: { presets: ['@babel/preset-env', '@babel/preset-react'], + plugins: ['macros'], overrides: [ { presets: [ diff --git a/yarn.lock b/yarn.lock index 2a2899c5..71c1d8b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -964,7 +964,7 @@ "@babel/helper-validator-option" "^7.14.5" "@babel/plugin-transform-typescript" "^7.16.1" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.15.4", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.16.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.5.tgz#7f3e34bf8bdbbadf03fbb7b1ea0d929569c9487a" integrity sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA== @@ -1878,6 +1878,15 @@ babel-plugin-macros@^2.8.0: cosmiconfig "^6.0.0" resolve "^1.12.0" +babel-plugin-macros@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz#9ef6dc74deb934b4db344dc973ee851d148c50c1" + integrity sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg== + dependencies: + "@babel/runtime" "^7.12.5" + cosmiconfig "^7.0.0" + resolve "^1.19.0" + babel-plugin-module-resolver@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz#22a4f32f7441727ec1fbf4967b863e1e3e9f33e2" @@ -5390,11 +5399,6 @@ rechoir@^0.7.0: dependencies: resolve "^1.9.0" -redux-devtools-extension@^2.13.2: - version "2.13.9" - resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.9.tgz#6b764e8028b507adcb75a1cae790f71e6be08ae7" - integrity sha512-cNJ8Q/EtjhQaZ71c8I9+BPySIBVEKssbPpskBfsXqb8HJ002A3KRVHfeRzwRo6mGPqsm7XuHTqNSNeS1Khig0A== - redux-logger@^3.0.6: version "3.0.6" resolved "https://registry.yarnpkg.com/redux-logger/-/redux-logger-3.0.6.tgz#f7555966f3098f3c88604c449cf0baf5778274bf" @@ -5535,7 +5539,7 @@ resolve-pathname@^3.0.0: resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== -resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.3.2, resolve@^1.9.0: +resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.19.0, resolve@^1.3.2, resolve@^1.9.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==