Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
peelar committed Jan 8, 2025
1 parent 006c078 commit ac27ee2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Attributes/AttributeRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ const AttributeRow: React.FC<AttributeRowProps> = ({
case AttributeInputTypeEnum.PLAIN_TEXT: {
// Since the API doesn't enforce a limit for plain text attribute length, we need to set one here. If we don't, the dashboard will freeze when the user tries to display a product with a long attribute value.
const MAX_LENGTH = 10000; // This is an arbitrary number. Dashboard will still work with a higher number, but it gets significantly slower.
const isTooLong = attribute.value[0]?.length > MAX_LENGTH;
const attributeValue = attribute.value[0];
const isTooLong = attributeValue?.length > MAX_LENGTH;

const value = getTruncatedTextValue(attribute.value[0], MAX_LENGTH);
const value = isTooLong ? getTruncatedTextValue(attributeValue, MAX_LENGTH) : attributeValue;

return (
<BasicAttributeRow
Expand Down

0 comments on commit ac27ee2

Please sign in to comment.