-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disperse v2 [WIP] #52
base: develop
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -164,7 +182,7 @@ export const WithAddressBook = ({children}: {children: React.ReactElement}): Rea | |||
try { | |||
const existingEntry = await getEntry({address: entry.address}); | |||
if (existingEntry) { | |||
const mergedChains = [...(existingEntry.chains || []), ...(entry.chains || [])]; | |||
const mergedChains = [...(entry.chains || [])]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const mergedChains = [...(entry.chains || [])]; | |
const mergedChains = [...(existingEntry.chains || []), ...(entry.chains || [])]; |
Once you update an entry for a given chain, you want to use the most up-to-date version of it, aka the one in the storage (from existingEntry
), not the one in the cache/state (from entry
) as base.
So [...storage, ...cache]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way it's not possible to update the chains completely. It was only possible to add new chains to the entry, but not removing some of them. The reason for that is we were always spreading existingEntry.chains
into merged chains which seemed wrong. I think that chains can be the only field to be overwritten. Can you pls provide some example when we actually need to spread the chains like this? It will help to come up with new logic for this
components/sections/Send/Wizard.tsx
Outdated
allSelected.forEach(input => onUpdateStatus(input.UUID, 'pending')); | ||
const {safeTxHash} = await sdk.txs.send({txs: transactions}); | ||
allSelected.forEach(input => onUpdateStatus(input.UUID, 'success')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this loops should be merged into one single forof
No description provided.