From 32ca88bea9f9bb5dcf54055e7e68ec097f9adefa Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 14 Sep 2020 16:44:10 +0200 Subject: [PATCH 1/3] set Vercel rewrites --- vercel.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vercel.json b/vercel.json index 20041cad5..37613bcf7 100644 --- a/vercel.json +++ b/vercel.json @@ -1,4 +1 @@ -{ - "cleanUrls": true, - "trailingSlash": false -} +{ "rewrites": [{ "source": "/asset/:did", "destination": "/asset/" }] } From 2761a615b93c9f942c358fd2720626465bf6fba5 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 14 Sep 2020 16:56:27 +0200 Subject: [PATCH 2/3] try getting title earlier --- src/components/templates/AssetDetails.tsx | 7 ++++--- src/pages/asset/index.tsx | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/templates/AssetDetails.tsx b/src/components/templates/AssetDetails.tsx index eeb6fd6e8..b8e8bafe1 100644 --- a/src/components/templates/AssetDetails.tsx +++ b/src/components/templates/AssetDetails.tsx @@ -2,11 +2,11 @@ import React, { useState, useEffect, ReactElement } from 'react' import { Router } from '@reach/router' import AssetContent from '../../components/organisms/AssetContent' import Layout from '../../components/Layout' -import { MetadataMarket, ServiceMetadataMarket } from '../../@types/Metadata' +import { MetadataMarket } from '../../@types/Metadata' import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib' import Alert from '../../components/atoms/Alert' import Loader from '../../components/atoms/Loader' -import { useOcean } from '@oceanprotocol/react' +import { useOcean, useMetadata } from '@oceanprotocol/react' export default function PageTemplateAssetDetails({ did, @@ -16,6 +16,7 @@ export default function PageTemplateAssetDetails({ uri: string }): ReactElement { const { config } = useOcean() + const metadataMinimal = useMetadata(did) const [metadata, setMetadata] = useState() const [title, setTitle] = useState() const [error, setError] = useState() @@ -61,7 +62,7 @@ export default function PageTemplateAssetDetails({ ) : ( - + ) diff --git a/src/pages/asset/index.tsx b/src/pages/asset/index.tsx index 58b98d51d..9594f5d2c 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -4,5 +4,6 @@ import PageTemplateAssetDetails from '../../components/templates/AssetDetails' export default function PageGatsbyAssetDetails(props: PageProps): ReactElement { const did = props.location.pathname.split('/')[2] + return } From 20acdf814a297c8f1c925cb3ce404ffdd9f44863 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 14 Sep 2020 17:02:09 +0200 Subject: [PATCH 3/3] rather use undefined title, which triggers fallback --- src/components/templates/AssetDetails.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/templates/AssetDetails.tsx b/src/components/templates/AssetDetails.tsx index b8e8bafe1..f3deda1ab 100644 --- a/src/components/templates/AssetDetails.tsx +++ b/src/components/templates/AssetDetails.tsx @@ -6,7 +6,7 @@ import { MetadataMarket } from '../../@types/Metadata' import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib' import Alert from '../../components/atoms/Alert' import Loader from '../../components/atoms/Loader' -import { useOcean, useMetadata } from '@oceanprotocol/react' +import { useOcean } from '@oceanprotocol/react' export default function PageTemplateAssetDetails({ did, @@ -16,7 +16,6 @@ export default function PageTemplateAssetDetails({ uri: string }): ReactElement { const { config } = useOcean() - const metadataMinimal = useMetadata(did) const [metadata, setMetadata] = useState() const [title, setTitle] = useState() const [error, setError] = useState() @@ -62,7 +61,7 @@ export default function PageTemplateAssetDetails({ ) : ( - + )