Skip to content

Commit

Permalink
Performance and Loading Speed Enhancements for the Website 🏎 (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaiyan-dev committed Oct 27, 2023
1 parent 8330187 commit 0a8f965
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions website/src/components/DeviceCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default function DeviceCard(props: {
className={`avatar__photo-link avatar__photo avatar__photo--xl ${styles.device__photo}`}
alt={imageAlt || `photograph of ${title}`}
src={image}
decoding="async"
/>
<div className="avatar__intro">
<div className="avatar__name">{title}</div>
Expand Down
3 changes: 2 additions & 1 deletion website/src/components/HeroImage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function HeroImage() {
loading="lazy"
src={hero}
alt="screenshot of the visual studio integration"
decoding="async"
/>
</div>
<div className={styles["mid-grid"]}>💖</div>
Expand All @@ -25,7 +26,7 @@ export default function HeroImage() {
}))
.filter(({ img, url }) => !!img && !!url)
.map(({ id, img, devName }) => (
<img key={id} src={img} alt={devName} title={devName} />
<img key={id} src={img} alt={devName} title={devName} decoding="async" />
))}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/KeyGenerator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react"
import React, { useState, useCallback } from "react"

function toHex(bytes: Uint8Array) {
let r = ""
Expand All @@ -9,14 +9,14 @@ function toHex(bytes: Uint8Array) {
}

export default function KeyGenerator() {
const compute = () => {
const compute = useCallback(() => {
if (typeof window === "undefined")
return "00000000000000000000000000000000"

const array = new Uint8Array(32) // Create a Uint8Array with 32 elements.
window.crypto.getRandomValues(array) // Fill the array with cryptographically strong random values.
return toHex(array)
}
}, [])

const [value, setValue] = useState(compute())

Expand Down

0 comments on commit 0a8f965

Please sign in to comment.