Skip to content

Commit

Permalink
feat: Ensure aliasText is not null in Entry component
Browse files Browse the repository at this point in the history
This commit modifies the `Entry` component to ensure that the `aliasText` variable is not null when assigning its value to the `textarea`. By using the nullish coalescing operator (`??`), the value is set to an empty string if `aliasText` is null. This change improves the reliability of the component.

Note: This message includes additional information for clarity. Please remove it before using the commit message.
  • Loading branch information
bramses committed Aug 27, 2024
1 parent 30b135c commit fffedc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const Entry = ({
'w-full px-0 text-sm text-gray-900 bg-white border-0 dark:bg-gray-800 focus:ring-0 dark:text-white dark:placeholder-gray-400';
textarea.placeholder = 'Write a comment...';
textarea.required = true;
textarea.value = aliasText;
textarea.value = aliasText ?? ''; // Ensure aliasText is not null

// append textarea to div
divTextarea.appendChild(textarea);
Expand Down Expand Up @@ -252,7 +252,7 @@ const Entry = ({
'w-full px-0 text-sm text-gray-900 bg-white border-0 dark:bg-gray-800 focus:ring-0 dark:text-white dark:placeholder-gray-400';
textarea.placeholder = 'Write a comment...';
textarea.required = true;
textarea.value = aliasText;
textarea.value = aliasText ?? ''; // Ensure aliasText is not null

// append textarea to div
divTextarea.appendChild(textarea);
Expand Down

0 comments on commit fffedc6

Please sign in to comment.