1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

periodically try to get DDO when not present yet

This commit is contained in:
Matthias Kretschmann 2020-10-21 16:43:23 +02:00
parent cc2474419b
commit 89709cbe73
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 13 additions and 5 deletions

View File

@ -16,9 +16,9 @@ export default function Datatoken(props: InputProps): ReactElement {
helpers.setValue({ ...dataTokenOptions })
}
// Generate new DT name & symbol, but only once automatically
// Generate new DT name & symbol
useEffect(() => {
if (!ocean || typeof field?.value?.name !== 'undefined') return
if (!ocean) return
generateName()
}, [ocean])

View File

@ -23,7 +23,7 @@ export default function Feedback({
<Button
style="primary"
size="small"
href={`/asset/${ddo?.id}`}
to={`/asset/${ddo?.id}`}
className={styles.action}
>
Go to data set

View File

@ -23,13 +23,17 @@ export default function PageTemplateAssetDetails({
useEffect(() => {
async function init() {
if (ddo) return
try {
const metadataCache = new MetadataCache(config.metadataCacheUri, Logger)
const ddo = await metadataCache.retrieveDDO(did)
if (!ddo) {
setTitle('Could not retrieve asset')
setError('The DDO was not found in MetadataCache.')
setError(
`The DDO for ${did} was not found in MetadataCache. If you just published a new data set, wait some seconds and refresh this page.`
)
return
}
@ -44,7 +48,11 @@ export default function PageTemplateAssetDetails({
}
}
init()
}, [did, config.metadataCacheUri])
// Periodically try to get DDO when not present yet
const timer = !ddo && setInterval(() => init(), 2000)
return () => clearInterval(timer)
}, [ddo, did, config.metadataCacheUri])
return did && metadata ? (
<Layout title={title} uri={uri}>