Skip to content

Commit

Permalink
Only truncate if theres a prefix (#2544)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Tideman authored Feb 6, 2025
1 parent c02a6c2 commit 217f395
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/components/event/metadata-decoder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
export let prefix: string = '';
export let onDecode: (decodedValue: string) => void | undefined = undefined;
const maxLength = 100;
const maxLength = 120;
let decodedValue = '';
Expand All @@ -34,9 +34,10 @@
const setPrefix = (metadata: string) => {
if (prefix) {
metadata = `${prefix} • ${metadata}`;
if (metadata.length < maxLength) return metadata;
return metadata.slice(0, maxLength) + '...';
}
if (metadata.length < maxLength) return metadata;
return metadata.slice(0, maxLength) + '...';
return metadata;
};
$: decodePayload = async (_value: Payload | undefined) => {
Expand Down

0 comments on commit 217f395

Please sign in to comment.