Properly differentiate pending/cant decode log data

This commit is contained in:
Willian Mitsuda 2021-09-23 18:46:08 -03:00
parent 380abf2adc
commit 13f32f8a35
2 changed files with 16 additions and 4 deletions

View File

@ -50,7 +50,19 @@ const LogEntry: React.FC<LogEntryProps> = ({ txData, log, logDesc }) => (
</Tab.List>
<Tab.Panels as={Fragment}>
<Tab.Panel className="space-y-2">
{logDesc && (
{logDesc === undefined ? (
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
<div className="col-start-2 flex space-x-2 items-center col-span-11">
Waiting for data...
</div>
</div>
) : logDesc === null ? (
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
<div className="col-start-2 flex space-x-2 items-center col-span-11">
No decoded data
</div>
</div>
) : (
<>
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
<div className="col-start-2 flex space-x-2 items-center col-span-11 font-mono">

View File

@ -33,7 +33,7 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata }) => {
1,
sourcifySource
);
const logDesc = useMemo(() => {
const logDescs = useMemo(() => {
if (!txData) {
return undefined;
}
@ -41,7 +41,7 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata }) => {
return txData.confirmedData?.logs.map((l) => {
const mt = metadatas[l.address];
if (!mt) {
return undefined;
return mt;
}
const abi = mt.output.abi;
@ -69,7 +69,7 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata }) => {
key={i}
txData={txData}
log={l}
logDesc={logDesc?.[i]}
logDesc={logDescs?.[i]}
/>
))}
</>