mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-10 18:15:37 +00:00
Remove safe loadedViaUrl from storage
This commit is contained in:
parent
08ec0a34b6
commit
9a845a2039
@ -24,6 +24,7 @@ import {
|
||||
safeTotalFiatBalanceSelector,
|
||||
safeNameSelector,
|
||||
safeParamAddressFromStateSelector,
|
||||
safeLoadedViaUrlSelector,
|
||||
} from 'src/logic/safe/store/selectors'
|
||||
import { currentCurrencySelector } from 'src/logic/currencyValues/store/selectors'
|
||||
import Modal from 'src/components/Modal'
|
||||
@ -83,8 +84,8 @@ const App: React.FC = ({ children }) => {
|
||||
const currentCurrency = useSelector(currentCurrencySelector)
|
||||
const granted = useSelector(grantedSelector)
|
||||
const sidebarItems = useSidebarItems()
|
||||
|
||||
const safeLoaded = useLoadSafe(safeAddress)
|
||||
const isSafeLoadedViaUrl = useSelector(safeLoadedViaUrlSelector)
|
||||
const safeLoaded = useLoadSafe(safeAddress, isSafeLoadedViaUrl)
|
||||
useSafeScheduledUpdates(safeLoaded, safeAddress)
|
||||
|
||||
const sendFunds = safeActionsState.sendFunds
|
||||
|
@ -21,8 +21,13 @@ const addressBookMiddleware = (store) => (next) => async (action) => {
|
||||
const { dispatch } = store
|
||||
const addressBook = addressBookSelector(state)
|
||||
const safes = safesListSelector(state)
|
||||
|
||||
if (addressBook.length) {
|
||||
await saveAddressBook(addressBook)
|
||||
const filteredSafeAddresses = safes
|
||||
.filter((safe) => !safe.loadedViaUrl)
|
||||
.map((safe) => safe.address)
|
||||
.toJS()
|
||||
await saveAddressBook(addressBook.filter((entry) => filteredSafeAddresses.includes(entry.address)))
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
|
@ -10,7 +10,7 @@ import fetchTransactions from 'src/logic/safe/store/actions/transactions/fetchTr
|
||||
import { Dispatch } from 'src/logic/safe/store/actions/types.d'
|
||||
import { updateAvailableCurrencies } from 'src/logic/currencyValues/store/actions/updateAvailableCurrencies'
|
||||
|
||||
export const useLoadSafe = (safeAddress?: string): boolean => {
|
||||
export const useLoadSafe = (safeAddress?: string, loadedViaUrl = true): boolean => {
|
||||
const dispatch = useDispatch<Dispatch>()
|
||||
const [isSafeLoaded, setIsSafeLoaded] = useState(false)
|
||||
|
||||
@ -23,7 +23,9 @@ export const useLoadSafe = (safeAddress?: string): boolean => {
|
||||
await dispatch(fetchSafeTokens(safeAddress))
|
||||
await dispatch(updateAvailableCurrencies())
|
||||
await dispatch(fetchTransactions(safeAddress))
|
||||
dispatch(addViewedSafe(safeAddress))
|
||||
if (!loadedViaUrl) {
|
||||
dispatch(addViewedSafe(safeAddress))
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatch(loadAddressBookFromStorage())
|
||||
|
@ -31,7 +31,7 @@ export const safeStorageMiddleware = (store) => (next) => async (action) => {
|
||||
const state = store.getState()
|
||||
const { dispatch } = store
|
||||
const safes = safesMapSelector(state)
|
||||
await saveSafes(safes.toJSON())
|
||||
await saveSafes(safes.filter((safe) => !safe.loadedViaUrl).toJSON())
|
||||
|
||||
switch (action.type) {
|
||||
case ADD_OR_UPDATE_SAFE: {
|
||||
|
@ -104,6 +104,8 @@ export const safeFeaturesEnabledSelector = createSelector(safeSelector, safeFiel
|
||||
|
||||
export const safeSpendingLimitsSelector = createSelector(safeSelector, safeFieldSelector('spendingLimits'))
|
||||
|
||||
export const safeLoadedViaUrlSelector = createSelector(safeSelector, safeFieldSelector('loadedViaUrl'))
|
||||
|
||||
export const safeOwnersAddressesListSelector = createSelector(
|
||||
safeOwnersSelector,
|
||||
(owners): List<string> => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user