Fix CSS loading error handling and port configuration inconsistencies#433
Draft
Fix CSS loading error handling and port configuration inconsistencies#433
Conversation
Co-authored-by: igorp1 <2934495+igorp1@users.noreply.github.com>
Co-authored-by: igorp1 <2934495+igorp1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] localhost:8000/global.css:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
Fix CSS loading error handling and port configuration inconsistencies
Aug 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue where users experience
localhost:8000/global.css Failed to load resource: net::ERR_CONNECTION_REFUSEDerrors when using Duffel Components with misconfiguredCOMPONENT_CDNsettings.Problem
The issue occurred when users set
COMPONENT_CDN=http://localhost:8000but didn't have a server running on that port. The component attempted to load CSS from${COMPONENT_CDN}/global.cssbut failed silently withERR_CONNECTION_REFUSED, causing sites to crash or components to render without proper styling.Additionally, there were inconsistencies in the documentation where examples referenced port 8000 instead of the correct development server port 3200.
Solution
1. Added Robust CSS Error Handling
2. Updated Components with Error Handling
WithComponentStyles.tsx: AddedonErrorhandler to the CSS link elementStaysAmenities.tsx: Added same error handling for direct CSS loading3. Fixed Documentation Inconsistencies
Updated all examples and README files to use the correct development server port:
COMPONENT_CDN=http://localhost:8000COMPONENT_CDN=https://localhost:3200Benefits
Testing
Added comprehensive tests to verify the error handling works correctly and all existing tests continue to pass.
The screenshot shows the component functioning properly with helpful error messages in the console when CSS loading fails, instead of the previous silent failure.
Fixes #421.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
downloads.sentry-cdn.com/usr/local/bin/node ./scripts/install.js(dns block)googlechromelabs.github.io/usr/local/bin/node install.mjs(dns block)https://storage.googleapis.com/chrome-for-testing-public/127.0.6533.88/linux64/chrome-headless-shell-linux64.zip/usr/local/bin/node install.mjs(http block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.