Commit ddf88345 authored by Moody Salem's avatar Moody Salem Committed by GitHub

fix(token lists): stop showing notifications for lists that are not selected (#1174)

parent 32ac2555
...@@ -13,6 +13,9 @@ export default function Updater(): null { ...@@ -13,6 +13,9 @@ export default function Updater(): null {
const { library } = useActiveWeb3React() const { library } = useActiveWeb3React()
const dispatch = useDispatch<AppDispatch>() const dispatch = useDispatch<AppDispatch>()
const lists = useSelector<AppState, AppState['lists']['byUrl']>(state => state.lists.byUrl) const lists = useSelector<AppState, AppState['lists']['byUrl']>(state => state.lists.byUrl)
const selectedListUrl = useSelector<AppState, AppState['lists']['selectedListUrl']>(
state => state.lists.selectedListUrl
)
const isWindowVisible = useIsWindowVisible() const isWindowVisible = useIsWindowVisible()
...@@ -54,6 +57,7 @@ export default function Updater(): null { ...@@ -54,6 +57,7 @@ export default function Updater(): null {
// automatically update minor/patch as long as bump matches the min update // automatically update minor/patch as long as bump matches the min update
if (bump >= min) { if (bump >= min) {
dispatch(acceptListUpdate(listUrl)) dispatch(acceptListUpdate(listUrl))
if (listUrl === selectedListUrl) {
dispatch( dispatch(
addPopup({ addPopup({
key: listUrl, key: listUrl,
...@@ -67,6 +71,7 @@ export default function Updater(): null { ...@@ -67,6 +71,7 @@ export default function Updater(): null {
} }
}) })
) )
}
} else { } else {
console.error( console.error(
`List at url ${listUrl} could not automatically update because the version bump was only PATCH/MINOR while the update had breaking changes and should have been MAJOR` `List at url ${listUrl} could not automatically update because the version bump was only PATCH/MINOR while the update had breaking changes and should have been MAJOR`
...@@ -75,6 +80,7 @@ export default function Updater(): null { ...@@ -75,6 +80,7 @@ export default function Updater(): null {
break break
case VersionUpgrade.MAJOR: case VersionUpgrade.MAJOR:
if (listUrl === selectedListUrl) {
dispatch( dispatch(
addPopup({ addPopup({
key: listUrl, key: listUrl,
...@@ -91,8 +97,9 @@ export default function Updater(): null { ...@@ -91,8 +97,9 @@ export default function Updater(): null {
) )
} }
} }
}
}) })
}, [dispatch, lists]) }, [dispatch, lists, selectedListUrl])
return null return null
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment