Skip to content

Commit 60cdb99

Browse files
committed
chore(perf): attempt to resolve some weird flickering on reloads
1 parent 763f690 commit 60cdb99

6 files changed

Lines changed: 19 additions & 11 deletions

File tree

.notes/todo.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@
2323
- [ ] flesh out package READMEs
2424
- [ ] put domain config into IaC w/ Terraform?
2525
- [ ] dedicated Identity page, then repurpose front page for something else? like Molly White's verify page: https://www.mollywhite.net/verify/
26-
- [ ] FA icon and avatar image flicker on page reload, font flicker on hard refresh
27-
- [ ] remove need for light/dark context
26+
- [ ] font flicker on hard refresh - could be a fallback problem?

apps/vivsha.ws/app/(home)/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ export default function Home() {
9393
<div className={profileCard}>
9494
<figure className={fig}>
9595
<Image
96-
src={author.avatar.image}
96+
src={author.avatar.src}
9797
alt={author.avatar.alt}
98+
width={80}
99+
height={80}
98100
className={avatar}
99101
priority
100102
/>

apps/vivsha.ws/app/layout.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import type { Viewport } from "next"
22
import type { Metadata } from "next/types"
3+
import { config } from "@fortawesome/fontawesome-svg-core"
4+
import "@fortawesome/fontawesome-svg-core/styles.css"
35
import {
46
DARK_COLOR_MODE_CLASS,
57
LIGHT_COLOR_MODE_CLASS,
68
tokens,
79
} from "@vivshaw/basalt"
810

911
import { author, COLOR_MODE_STORAGE_KEY, site } from "#data"
12+
13+
// prevent Font Awesome from auto-injecting CSS (i import it above)
14+
// i do this because the auto-injection was causing a flicker of weird sizing
15+
config.autoAddCss = false
1016
import { metadataHelper } from "#lib/metadataHelpers"
1117

1218
export const viewport: Viewport = {

apps/vivsha.ws/data/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import type { StaticImageData } from "next/image"
21
import { z } from "zod"
32

4-
import avatarPic from "#images/avatar.jpg"
5-
63
/**
74
* the key in `localStorage`used to store the app's color mode
85
*/
@@ -59,7 +56,9 @@ type Author = {
5956
/** profile picture and alt text */
6057
avatar: {
6158
alt: string
62-
image: StaticImageData
59+
src: string
60+
width: number
61+
height: number
6362
}
6463

6564
/** short bio */
@@ -95,8 +94,10 @@ type Author = {
9594
export const author: Author = {
9695
alumniOf: "University of Vermont, University of Colorado Boulder",
9796
avatar: {
98-
image: avatarPic,
97+
src: "/avatar.jpg",
9998
alt: "A photo of Hannah in a Smithsonian display of a giant salt molecule",
99+
width: 400,
100+
height: 400,
100101
},
101102
bio: "function enthusiast, JavaScript wrangler, browser whisperer, code obfuscator, machine enlightener",
102103
gender: "female",

apps/vivsha.ws/lib/metadataHelpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ export function schemaHelper(data: SeoData) {
221221
"@type": "ImageObject",
222222
"@id": authorImageId,
223223
inLanguage: "en-US",
224-
url: author.avatar.image.src,
225-
width: `${author.avatar.image.width}`,
226-
height: `${author.avatar.image.height}`,
224+
url: author.avatar.src,
225+
width: `${author.avatar.width}`,
226+
height: `${author.avatar.height}`,
227227
}
228228

229229
const commonSchema = [

0 commit comments

Comments
 (0)