Skip to content

Conversation

@lutfi-zain
Copy link

@lutfi-zain lutfi-zain commented Jan 4, 2026

Summary

  • Replace build-time import.meta.glob with runtime fetch() for product data files
  • Fix Windows CRLF line ending issues that prevented markdown parsing
  • Enable hot-reloading of product files without dev server restart

Related PRs

This PR consolidates and extends the CRLF fixes from:

All three PRs address the same Windows line ending issue but only in product-loader.ts. This PR applies the fix across all loaders and adds hot-reload support.

Problem

Product markdown files (roadmap, overview, data model, etc.) were loaded at build time using Vite's import.meta.glob. This caused two issues:

  1. Dev server restart required: Any changes to files in product/ directory required restarting the dev server to see updates
  2. Windows compatibility: Files with CRLF line endings (\r\n) failed to parse correctly, causing "No Roadmap Defined Yet" even when the file existed

Solution

  • Converted all product loaders to use fetch() with cache-busting in dev mode
  • Added CRLF → LF normalization in all markdown parsing functions
  • Created useProductData hook for consistent async loading pattern
  • Added loading states to all affected pages

Changes

File Change
src/lib/product-loader.ts Async fetch, CRLF fix, added fetchProductData()
src/lib/data-model-loader.ts Async fetch, CRLF fix
src/lib/design-system-loader.ts Async fetch for JSON files
src/lib/shell-loader.ts Async fetch for spec.md, components remain build-time
src/lib/use-product-data.ts New - shared hook for async data loading
src/components/*Page.tsx Updated to use useProductData hook with loading states
src/components/PhaseNav.tsx Async loading support
src/components/PhaseWarningBanner.tsx Async loading support

Testing

  • Verified with Playwright that all 4 roadmap sections render correctly
  • Confirmed hot-reload works when editing product/*.md files
  • Tested on Windows with CRLF line endings

Breaking Changes

None. The async loading is handled internally with loading states.

- Replace build-time import.meta.glob with runtime fetch() for markdown/JSON files
- Add useProductData hook for consistent async loading across components
- Normalize Windows line endings (CRLF) in markdown parsers
- Enable hot-reloading of product files without dev server restart
@lutfi-zain lutfi-zain changed the title Switch to Dynamic Data Loading for Product Files FIX: CRLF & Switch to Dynamic Data Loading for Product Files (ref PR: #14 #15 #16) Jan 4, 2026
@unrayed
Copy link

unrayed commented Jan 5, 2026

Still not perfect, sections dont load only the first one manages to load everything except /design-screen, and the other ones dont at all

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