Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
reduxjs/tooklit updated and added isAnyOf
Browse files Browse the repository at this point in the history
  • Loading branch information
W3stside committed Dec 9, 2020
1 parent c8519d3 commit 8a93d5a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@popperjs/core": "^2.4.4",
"@reach/dialog": "^0.10.3",
"@reach/portal": "^0.10.3",
"@reduxjs/toolkit": "^1.3.5",
"@reduxjs/toolkit": "^1.5.0",
"@types/jest": "^25.2.1",
"@types/lodash.flatmap": "^4.5.6",
"@types/luxon": "^1.24.4",
Expand Down
14 changes: 9 additions & 5 deletions src/custom/state/fee/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Middleware } from '@reduxjs/toolkit'
import { isAnyOf, Middleware } from '@reduxjs/toolkit'
import { getFee } from 'utils/fees'
import { selectCurrency } from '@src/state/swap/actions'
import { updateFee } from './actions'
import { FeeInformationState } from './reducer'

export const applyFeeMiddleware: Middleware = ({ dispatch, getState }) => next => async action => {
// check that incoming action is a selected token
const isTriggerAction = action.type === selectCurrency.type
const isCurrencyChangeAction = isAnyOf(selectCurrency)

if (isTriggerAction) {
export const applyFeeMiddleware: Middleware = ({ dispatch, getState }) => next => async action => {
if (isCurrencyChangeAction(action)) {
console.debug(`
========================================================
🚀 [FEE MIDDLEWARE] SELECT_CURRENCY ACTION DETECTED
========================================================
`)
const { payload } = action

// check actions as several should trigger this update
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2086,12 +2086,12 @@
tslib "^2.0.0"
warning "^4.0.3"

"@reduxjs/toolkit@^1.3.5":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@reduxjs/toolkit/-/toolkit-1.4.0.tgz#ee2e2384cc3d1d76780d844b9c2da3580d32710d"
integrity sha512-hkxQwVx4BNVRsYdxjNF6cAseRmtrkpSlcgJRr3kLUcHPIAMZAmMJkXmHh/eUEGTMqPzsYpJLM7NN2w9fxQDuGw==
"@reduxjs/toolkit@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@reduxjs/toolkit/-/toolkit-1.5.0.tgz#1025c1ccb224d1fc06d8d98a61f6717d57e6d477"
integrity sha512-E/FUraRx+8guw9Hlg/Ja8jI/hwCrmIKed8Annt9YsZw3BQp+F24t5I5b2OWR6pkEHY4hn1BgP08FrTZFRKsdaQ==
dependencies:
immer "^7.0.3"
immer "^8.0.0"
redux "^4.0.0"
redux-thunk "^2.3.0"
reselect "^4.0.0"
Expand Down Expand Up @@ -8441,10 +8441,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/immer/-/immer-1.10.0.tgz#bad67605ba9c810275d91e1c2a47d4582e98286d"
integrity sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg==

immer@^7.0.3:
version "7.0.7"
resolved "https://registry.yarnpkg.com/immer/-/immer-7.0.7.tgz#9dfe713d49bf871cc59aedfce59b1992fa37a977"
integrity sha512-Q8yYwVADJXrNfp1ZUAh4XDHkcoE3wpdpb4mC5abDSajs2EbW8+cGdPyAnglMyLnm7EF6ojD2xBFX7L5i4TIytw==
immer@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/immer/-/immer-8.0.0.tgz#08763549ba9dd7d5e2eb4bec504a8315bd9440c2"
integrity sha512-jm87NNBAIG4fHwouilCHIecFXp5rMGkiFrAuhVO685UnMAlOneEAnOyzPt8OnP47TC11q/E7vpzZe0WvwepFTg==

import-cwd@^2.0.0:
version "2.1.0"
Expand Down

0 comments on commit 8a93d5a

Please sign in to comment.