mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
periodically try to get DDO when not present yet
This commit is contained in:
parent
cc2474419b
commit
89709cbe73
@ -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])
|
||||
|
||||
|
@ -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 →
|
||||
|
@ -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}>
|
||||
|
Loading…
Reference in New Issue
Block a user