Skip to content

Commit

Permalink
[Explorer]: Fix error render on Object page (#13851)
Browse files Browse the repository at this point in the history
## Description 

- Fix error rendering for Object page

BEFORE
<img width="865" alt="Screenshot 2023-09-19 at 12 03 17 PM"
src="https://github.com/MystenLabs/sui/assets/127577476/08d647f4-4f30-40b3-b4f2-f10daee19c25">

AFTER

<img width="811" alt="Screenshot 2023-09-19 at 12 03 21 PM"
src="https://github.com/MystenLabs/sui/assets/127577476/13395dfe-6e1f-4bb1-bcaf-2df1e72eb7a7">


## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
plam-ml authored Sep 19, 2023
1 parent 8fc58eb commit ecb239f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
28 changes: 17 additions & 11 deletions apps/explorer/src/pages/object-result/views/ObjectView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ export function ObjectView({ data }: ObjectViewProps) {
const objectType = parseObjectType(data);
const objOwner = data.data?.owner;
const storageRebate = data.data?.storageRebate;
const objectId = data.data?.objectId;
const lastTransactionBlockDigest = data.data?.previousTransaction;

const heroImageTitle = name || display?.description || trimStdLibPrefix(objectType);
const heroImageSubtitle = video ? 'Video' : fileType ?? '';
Expand Down Expand Up @@ -257,18 +259,22 @@ export function ObjectView({ data }: ObjectViewProps) {
</div>
)}

<div style={{ gridArea: 'description' }}>
<DescriptionCard
name={name}
objectType={objectType}
objectId={data.data?.objectId!}
display={display}
/>
</div>
{objectId && (
<div style={{ gridArea: 'description' }}>
<DescriptionCard
name={name}
objectType={objectType}
objectId={objectId}
display={display}
/>
</div>
)}

<div style={{ gridArea: 'version' }}>
<VersionCard version={data.data?.version} digest={data.data?.previousTransaction!} />
</div>
{lastTransactionBlockDigest && (
<div style={{ gridArea: 'version' }}>
<VersionCard version={data.data?.version} digest={lastTransactionBlockDigest} />
</div>
)}

<div style={{ gridArea: 'owner' }}>
<OwnerCard objOwner={objOwner} display={display} storageRebate={storageRebate} />
Expand Down
20 changes: 12 additions & 8 deletions apps/explorer/src/ui/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ export function PageHeader({ title, subtitle, type, before, error, loading }: Pa
{loading ? (
<Placeholder rounded="lg" width="540px" height="20px" />
) : (
<div className="flex items-center">
<Heading as="h3" variant="heading3/semibold" color="gray-90" mono>
{title}
</Heading>
<div className="ml-2 h-4 w-4 self-start md:h-6 md:w-6">
<CopyToClipboard size="lg" color="steel" copyText={title} />
</div>
</div>
<>
{title && (
<div className="flex items-center">
<Heading as="h3" variant="heading3/semibold" color="gray-90" mono>
{title}
</Heading>
<div className="ml-2 h-4 w-4 self-start md:h-6 md:w-6">
<CopyToClipboard size="lg" color="steel" copyText={title} />
</div>
</div>
)}
</>
)}
</div>
{subtitle && (
Expand Down

2 comments on commit ecb239f

@vercel
Copy link

@vercel vercel bot commented on ecb239f Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ecb239f Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.