hashicorp / react-components

A set of HashiCorp branded react components currently maintained and used by the marketing dev team
https://react-components.vercel.app
Mozilla Public License 2.0
60 stars 17 forks source link

fix: correctly determine if array is empty #1005

Closed dstaley closed 11 months ago

dstaley commented 1 year ago

🎟️ [Asana Task]() 🔍 Preview Link


Description

This PR fixes an empty array comparison. In JavaScript, arrays are objects, and equality comparisons only return true if both sides of the operator refer to the same object. By comparing to an empty array literal, this comparison will always return false. In recent versions of TypeScript, this is considered an error, which prevents builds using this code. This PR changes to compare by length instead.

PR Checklist 🚀

Items in this checklist may not may not apply to your PR, but please consider each item carefully.

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 5e9d77c5b08b43c87860c0d6823c03f8d6882886

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------------- | ----- | | @hashicorp/react-docs-page | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2023 11:48pm
github-actions[bot] commented 1 year ago

:package: Canary Packages Published

Latest commit: 5e9d77c5b08b43c87860c0d6823c03f8d6882886

Published 1 packages #### @hashicorp/react-docs-page@17.9.1-canary-20231218234848 ``` npm install @hashicorp/react-docs-page@canary ```