Skip to content

Conversation

briandoyle81
Copy link
Contributor

@briandoyle81 briandoyle81 commented Aug 27, 2025

Improves GTMetrix Grade from D to C (possibly even more once the vercel overhead isn't present)
Simulates Flow Runner until mouseover to save on loading
Font is now local instead of remote
Font is now wolff2 instead of otf
Removed several duplicate loads of Inter
Removed unused svgs

Copy link

vercel bot commented Aug 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Sep 2, 2025 4:48pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive site loading optimizations, improving GTMetrix Grade from D to C by introducing several performance enhancements: font optimization with local WOFF2 formats, lazy loading for Flow Runner components, caching headers, and reduced bundle sizes.

  • Switched from remote to local WOFF2 fonts with TTF fallbacks for better compression and performance
  • Implemented lazy loading for Flow Runner iframe until mouseover to reduce initial load time
  • Added comprehensive caching headers for static assets in Vercel configuration

Reviewed Changes

Copilot reviewed 16 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vercel.json Added comprehensive caching headers for static assets
src/plugins/font-preload.js New plugin for preloading critical fonts in WOFF2 format
src/hooks/use-icons.ts Refactored to use static paths instead of dynamic imports
src/components/Icon.tsx Simplified to always render as images with static paths
src/ui/design-system/src/lib/Pages/HomePage/QuickStartShowcase.tsx Added lazy loading for Flow Runner with fallback UI
static/css/* Added optimized CSS files for KaTeX and codicon fonts
src/ui/design-system/styles/fonts.css Removed duplicate Inter font declarations, added font-display: swap
docusaurus.config.js Updated to use local fonts and CSS instead of remote resources

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -26,6 +26,7 @@
"@docusaurus/preset-classic": "^3.5.2",
"@docusaurus/types": "^3.5.2",
"@floating-ui/react-dom": "1.3.0",
"@fluentui/react": "^8.123.5",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the new icon set? Should we remove the old and swap it out with this one so there are not two?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That has the specific microsoft icons for the fake flowrunner. Happy to do it another way if that's better!

import { Icon, initializeIcons } from '@fluentui/react';

// Initialize Fluent UI icons
initializeIcons();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be done on an app layout page at some shared level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno! But I don't think those icons will be used outside of this component anytime in the near future.

briandoyle81 and others added 2 commits August 29, 2025 08:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
import RandomIcon from '@site/static/images/icons/random.svg';
import FaucetIcon from '@site/static/images/icons/Faucet.svg';
// Static icon paths - more reliable than dynamic imports
const getIconPath = (name: IconName): string | null => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just have an object map? Is there a point to the function loading it into the map? Feels redundant.

const iconMap: Record<IconName, string> = {
  [IconName.GETTING_STARTED]: '/images/icons/getting-started.svg',
  [IconName.WHY_FLOW]: '/images/icons/why-flow.svg',
  [IconName.HELLO_WORLD]: '/images/icons/hello-world.svg',
  [IconName.FLOW_CADENCE]: '/images/icons/flow-cadence.svg',
  [IconName.EVM_ON_FLOW]: '/images/icons/evm-on-flow.svg',
  [IconName.RANDOM]: '/images/icons/random.svg',
  [IconName.BATCHED_EVM_TRANSACTIONS]: '/images/icons/batched-evm-transactions.svg',
  // ... rest of them
};

'uniblock': '/img/ecosystem/uniblock.svg',
}), []);
return useMemo(() => {
const loadIcon = (name: IconName) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then if you have the map do you even need this?

'uniblock': '/img/ecosystem/uniblock.svg',
}), []);
return {
getIcon: (name: IconName): string | null => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using this?

</div>
);
// Get icon path
const iconPath = icons.loadIcon(name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this exist?

@briandoyle81 briandoyle81 merged commit 85e0921 into main Sep 2, 2025
3 checks passed
@briandoyle81 briandoyle81 deleted the brian-doyle/optimize-site-loading branch September 2, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants