Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the senator portrait image load issue #387

Merged
merged 3 commits into from
Jan 27, 2024

Conversation

iamlogand
Copy link
Owner

@iamlogand iamlogand commented Jan 27, 2024

Make senator images load quick, which closes #385. The solution was to reduce the size of the images and disable Next.js image optimization for them. Disabling image optimization has counterintuitively made the initial load times much quicker. Now, when the image first loads, it's cached and used again whenever that same image is needed, regardless of size. This means that when a senator is selected, the large image will always appear instantly because it's already been downloaded.

Next.js image optimization is bad for this use case (or I might be misusing it). However, the Next.js Image component is still marginally better than the standard image tag because of the placeholder prop, which is useful for users with particularly slow connections (e.g. slow 3G).

@iamlogand iamlogand added the cosmetic UI changes that have little or no impact on functionality, but may enhance usability label Jan 27, 2024
@iamlogand iamlogand merged commit b4b23b7 into main Jan 27, 2024
1 check passed
@iamlogand iamlogand deleted the fix/senator-portrait-image-preload branch January 27, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmetic UI changes that have little or no impact on functionality, but may enhance usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preload senator portraits
1 participant