Skip to content

Commit bc50e02

Browse files
committed
Merge branch 'acl2809/blog-post'
2 parents 1b9b025 + 0c140a7 commit bc50e02

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
layout: post
3+
4+
categories:
5+
- Contribution
6+
7+
# Enter your name below
8+
author: Alex Leute
9+
---
10+
11+
# Ritchie's Bus Schedule: Eager loading for the welcome image
12+
For my contribution, I'm contributing to Ritchie's Bus Schedule. I'm
13+
contributing to this software because it's something I use personally, so it
14+
makes sense for me to contribute to it.
15+
## Introduction to the Community
16+
[Ritchie's Bus Schedule](https://www.rit-bus.app/) is a community-made bus
17+
schedule, that is a better version of the official website. It's important that
18+
this exists because the buses at RIT are inconsistent, and the existing website
19+
is hard to use.
20+
21+
This project was a good pick based on what I learned from the Comm Arch
22+
experience. There seems to be an active community, and good tests and
23+
documentation, as well as a good community.
24+
25+
## The issue
26+
I chose this issue
27+
[#109](https://github.com/hiromon0125/ritchie-bus-schedule/issues/109) because
28+
it was marked as a good first issue, which is correct, it was not difficult to
29+
reproduce, and had a simple fix. The welcome image is loaded lazily, which is
30+
bad for performance. Because it's above the fold, it'll be displayed
31+
immediately, so lazy loading will make it take longer for the whole page to do
32+
it's first render.
33+
34+
Looking at the issue description, I quickly determined a possible solution to
35+
the problem based on the documentation for the Next.js Image:
36+
```diff
37+
diff --git a/src/app/_components/welcome.tsx b/src/app/_components/welcome.tsx
38+
index 7163264..3a35b42 100644
39+
--- a/src/app/_components/welcome.tsx
40+
+++ b/src/app/_components/welcome.tsx
41+
@@ -34,6 +34,7 @@ export default function WelcomePopup() {
42+
alt="banner"
43+
height={1201}
44+
width={630}
45+
+ loading="eager"
46+
/>
47+
</div>
48+
<div className=" h-3 w-full bg-linear-to-b from-[#e1ecf7] to-[#e1ecf700]" />
49+
```
50+
After writing this solution, I ran the lighthouse performance test again, and
51+
found that I had significantly improved the performance compared to before, so
52+
I submitted a PR for it, which then got merged.
53+
![A GitHub PR. I comment "For #109 It might also be a good idea to eagerly load the map too, but I don't know if it'll make as big of a difference because it might not be on the screen. hiromon0125 comments "oh i just merged without properly reviewing it lol, but this is good."](../assets/images/acl2809/pr.png)

assets/images/acl2809/pr.png

231 KB
Loading

0 commit comments

Comments
 (0)