Open MariusVanDerWijden opened 3 years ago
Hmm, this doesn't seem to work for him.
Seems the vorple
now reinits whenever the backend refreshes.
I proposed to implement something like this:
initialized = false // has to be global
...
if !initialized {
vorple.init()
initialized = true
}
Taking a look
@MariusVanDerWijden I got the same result as you moving the init and could not replicate the reinit experienced by the user, either.
They can do the check in App.jsx L313:
<Route path="/vorple2">
{address === vorpAddress ?
<Vorple2
address={address}
VorpAddress={vorpAddress}
userProvider={userProvider}
mainnetProvider={mainnetProvider}
localProvider={localProvider}
tx={tx}
writeContracts={writeContracts}
/>
:
null
}
</Route>
And leave the Vorple2 component unchanged. That way React won't put the Vorple 2 component on the dom. They'll have to clean up the component code because only the userAddress ==[sic] vorpAddress
branch will ever run. But this is the quickest way.
Q:
Proposed solution: Only initializing the vorple if the userAddress was correct