Skip to content

Commit 5029ae0

Browse files
fix: ms cdn not working anymore
1 parent 0fba9ba commit 5029ae0

25 files changed

+251
-13
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Icon CORS Issue Fix - Summary
2+
3+
## Problem
4+
The application was trying to load icon resources from Microsoft's CDN (`https://spoppe-b.azureedge.net`), which was causing CORS errors:
5+
1. **Fabric Icons (fonts)**: Font files for MDL2 icons
6+
2. **File Type Icons (images)**: PNG/SVG images for file type icons (csv, xlsx, pdf, etc.)
7+
8+
Both CDN resources are no longer accessible, causing missing icons throughout the application.
9+
10+
## Solution
11+
12+
### 1. Fabric MDL2 Icons (Font-based) ✅
13+
**Location**: `packages/rath-client/public/fonts/`
14+
15+
- Copied 19 `.woff` font files from `@fluentui/font-icons-mdl2` package to `public/fonts/`
16+
- Updated `src/index.tsx` to initialize icons with local path: `initializeIcons('/fonts/')`
17+
- These fonts are now served from the application's own domain
18+
19+
**Files copied**:
20+
- `fabric-icons-0-467ee27f.woff` through `fabric-icons-17-0c4ed701.woff`
21+
- `fabric-icons-a13498cf.woff`
22+
23+
### 2. File Type Icons (Image-based) ✅
24+
**Solution**: Replaced image-based icons with font-based MDL2 icons
25+
26+
Instead of downloading hundreds of PNG/SVG images from Microsoft's CDN, we created a custom mapping that uses FluentUI MDL2 font icons (which we already have locally).
27+
28+
**New File**: `src/utils/fileIconMapper.ts`
29+
- Maps file extensions to appropriate MDL2 icon names
30+
- Supports 100+ file types including:
31+
- Office: Word, Excel, PowerPoint
32+
- Data: CSV, JSON, XML, databases
33+
- Code: JS, TS, Python, etc.
34+
- Media: Images, videos, audio
35+
- Archives: ZIP, RAR, 7z, etc.
36+
37+
**Updated Files**:
38+
- `src/pages/dataConnection/history/get-file-icon.tsx`
39+
- `src/pages/dataSource/selection/history/get-file-icon.tsx`
40+
41+
**Removed Dependency**: No longer using `@fluentui/react-file-type-icons` CDN
42+
43+
## Benefits
44+
45+
1. **No External Dependencies**: All icons served from the application domain
46+
2. **No CORS Errors**: Complete control over asset delivery
47+
3. **Faster Loading**: Font-based icons are lighter than images
48+
4. **Offline Support**: Application works without internet access to Microsoft CDN
49+
5. **Consistent Styling**: All icons use the same FluentUI design system
50+
51+
## Testing
52+
53+
After building, verify that:
54+
1. All icons in the navigation and UI load correctly
55+
2. File type icons in history lists show appropriate icons
56+
3. No console errors about missing resources or CORS
57+
4. No requests to `spoppe-b.azureedge.net` in Network tab
58+
59+
## Build Instructions
60+
61+
```bash
62+
cd packages/rath-client
63+
yarn build:client
64+
```
65+
66+
The fonts in `public/fonts/` will automatically be copied to `build/fonts/` during the build process.
67+
68+
## Maintenance
69+
70+
If updating `@fluentui/font-icons-mdl2` package version:
71+
```bash
72+
cp node_modules/@fluentui/font-icons-mdl2/fonts/*.woff packages/rath-client/public/fonts/
73+
```
74+
75+
To add support for new file types, edit `src/utils/fileIconMapper.ts` and add the extension to icon name mapping.
76+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Fluent UI Icon Fonts
2+
3+
This directory contains the icon font files from `@fluentui/font-icons-mdl2` package.
4+
5+
## Purpose
6+
7+
These fonts are hosted locally to avoid CORS issues when loading from Microsoft's CDN. The fonts are automatically loaded when the application initializes icons via `initializeIcons('/fonts/')` in `src/index.tsx`.
8+
9+
## Maintenance
10+
11+
If you update the `@fluentui/font-icons-mdl2` package version, you may need to update these font files:
12+
13+
```bash
14+
cp node_modules/@fluentui/font-icons-mdl2/fonts/*.woff packages/rath-client/public/fonts/
15+
```
16+
17+
## Files
18+
19+
The directory contains multiple font files (fabric-icons-*.woff) that are split by icon set to optimize loading performance.
20+
12.5 KB
Binary file not shown.
12.8 KB
Binary file not shown.
12.1 KB
Binary file not shown.
12.1 KB
Binary file not shown.
12.2 KB
Binary file not shown.
15.8 KB
Binary file not shown.
11.3 KB
Binary file not shown.
13.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)