-
Notifications
You must be signed in to change notification settings - Fork 93
Add recipient registry info to store #358
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,17 +43,11 @@ import { Watch } from 'vue-property-decorator' | |
|
||
import { recipientRegistryType } from '@/api/core' | ||
import { getCurrentRound } from '@/api/round' | ||
import { getRecipientRegistryAddress } from '@/api/projects' | ||
import { getRegistryInfo } from '@/api/recipient-registry-optimistic' | ||
|
||
import Cart from '@/components/Cart.vue' | ||
import Profile from '@/components/Profile.vue' | ||
|
||
import { LOAD_USER_INFO, LOAD_ROUND_INFO, LOAD_RECIPIENT_REGISTRY_INFO } from '@/store/action-types' | ||
import { | ||
SET_RECIPIENT_REGISTRY_ADDRESS, | ||
SET_RECIPIENT_REGISTRY_INFO, | ||
} from '@/store/mutation-types' | ||
import { LOAD_USER_INFO, LOAD_ROUND_INFO, LOAD_RECIPIENT_REGISTRY_INFO, SELECT_ROUND } from '@/store/action-types' | ||
|
||
@Component({ | ||
name: 'clr.fund', | ||
|
@@ -88,13 +82,10 @@ export default class App extends Vue { | |
}, 60 * 1000) | ||
} | ||
|
||
// TODO commit() approach? Or dispatch() on interval? | ||
async mounted() { | ||
const roundAddress = this.$store.state.currentRoundAddress || await getCurrentRound() | ||
const registryAddress = this.$store.state.recipientRegistryAddress || await getRecipientRegistryAddress(roundAddress) | ||
this.$store.commit(SET_RECIPIENT_REGISTRY_ADDRESS, registryAddress) | ||
const registryInfo = this.$store.state.recipientRegistryInfo || await getRegistryInfo(registryAddress) | ||
this.$store.commit(SET_RECIPIENT_REGISTRY_INFO, registryInfo) | ||
const roundAddress = await getCurrentRound() | ||
await this.$store.dispatch(SELECT_ROUND, roundAddress) | ||
this.$store.dispatch(LOAD_RECIPIENT_REGISTRY_INFO) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct because the round address can also come from route parameter in See my previous comment on this section of code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Construction of the app's state begins with a round address, because almost everything else depends on it. There are two ways in which this variable can be set:
(1) is the reason why the initialization does not currently take place in the Your proposed change simply creates a race for dispatching There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation.
Where does this logic take place? Does it happen on page load / app initialization? I see we dispatch |
||
} | ||
|
||
toggleNavBar() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import { | |
import { recipientRegistryType } from '@/api/core' | ||
import { loginUser, logoutUser } from '@/api/gun' | ||
import { getRegistryInfo, RegistryInfo } from '@/api/recipient-registry-optimistic' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other types of registries (such as Kleros adapter) can have registry info too, but of different type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked out |
||
import { getRecipientRegistryAddress } from '@/api/projects' | ||
import { RoundInfo, RoundStatus, getRoundInfo } from '@/api/round' | ||
import { storage } from '@/api/storage' | ||
import { Tally, getTally } from '@/api/tally' | ||
|
@@ -183,7 +184,8 @@ const actions = { | |
} | ||
}, | ||
async [LOAD_RECIPIENT_REGISTRY_INFO]({ commit, state }) { | ||
const recipientRegistryAddress = state.recipientRegistryAddress | ||
const recipientRegistryAddress = state.recipientRegistryAddress || await getRecipientRegistryAddress(state.currentRoundAddress) | ||
commit(SET_RECIPIENT_REGISTRY_ADDRESS, recipientRegistryAddress) | ||
if (recipientRegistryAddress === null || recipientRegistryType !== 'optimistic') { | ||
commit(SET_RECIPIENT_REGISTRY_INFO, null) | ||
return | ||
|
Uh oh!
There was an error while loading. Please reload this page.