-
-
Notifications
You must be signed in to change notification settings - Fork 172
fix: fixed bug from issue #1369 #1382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Rolled back the formatting of the <FullScreenMap.tsx> file to its previous appearance. There are no functional changes — the original design of the code has been returned, accidental format changes have been removed.
fix: bugs fixed after review(2)
There was a problem hiding this 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 loading and error handling for the GlobalMap component to fix issue #1369. The changes add visual feedback during map loading and provide a user-friendly error recovery mechanism when the map fails to load.
Key Changes
- Added loading state with spinner and timeout mechanism (10 seconds)
- Implemented error handling for map load failures with error event listener
- Created error UI with reload functionality to recover from map errors
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| setIsLoading(false) | ||
| setHasError(false) | ||
|
|
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace on line 107 should be removed to maintain clean code formatting.
|
|
||
| useEffect(() => { | ||
| if (!mapInstance) return | ||
| const handleError = (err: any) => { |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error parameter type is 'any' which bypasses type safety. Consider using a more specific type like 'Error' or 'MapboxError' if available from the map library.
| const handleError = (err: any) => { | |
| const handleError = (err: Error) => { |
| <div className='relative w-full h-full'> | ||
| <Map | ||
| {hasError && ( | ||
| <div className="absolute inset-0 flex items-center justify-center bg-white/20 "> |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing space inside the className string should be removed for cleaner code.
| <div className="absolute inset-0 flex items-center justify-center bg-white/20 "> | |
| <div className="absolute inset-0 flex items-center justify-center bg-white/20"> |
| </div> | ||
| )} | ||
|
|
||
| {!hasError &&<Map |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between '&&' and '<Map' reduces readability. Add a space for proper formatting.
| {!hasError &&<Map | |
| {!hasError && <Map |
| )} | ||
| {children} | ||
| </Map> | ||
| </Map>} |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The closing JSX brace should be on the same line as '' or properly indented on a new line for better readability.
| </Map>} | |
| </Map> | |
| } |
This Pull request Fixes #1369
Adding a loading screen and error message with a restart button.
Type of PR.
Description
Added loading and error state handling for the map:
Related Issues
issue #1369
What this PR achieves
Screenshots
Loading Error
Normal loading