Skip to content

Fix unhandled validation error, add Not Found Page#28

Merged
fityannugroho merged 6 commits intomainfrom
fix/handling-detail-area-page
Oct 14, 2024
Merged

Fix unhandled validation error, add Not Found Page#28
fityannugroho merged 6 commits intomainfrom
fix/handling-detail-area-page

Conversation

@fityannugroho
Copy link
Owner

PR Checklist

Please check if your PR fulfills the following requirements:

Put [x] to check

  • I have read the documentation.
  • I have read and followed the Contributing Guidelines.
  • I have included a pull request description of my changes.
  • I have included the necessary changes to the documentation.
  • I have added tests to cover my changes.

PR Type

What kind of change does this PR introduce?

Please check any kind of changes that applies to this PR using [x]

  • Bug fix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes

What is the current behavior?

Please describe the current behavior that you are modifying, or link to a relevant issue.

Issue Number: N/A

Invalid area code will throw unhandled validation error

What is the new behavior?

This pull request includes several changes to improve error handling, simplify the codebase, and enhance the user experience. The most important changes include adding error handling for invalid area codes, simplifying the Home page, and creating a new NotFound page.

Error Handling Improvements:

  • app/(main)/[code]/page.tsx: Added error handling for invalid area codes in generateMetadata and DetailAreaPage functions, returning a "Not Found" response when an error occurs.
  • app/api/og-image/area/[code]/route.tsx: Added error handling for invalid area codes, returning a JSON response with a 400 status.

Code Simplification:

  • Simplified the Home page by directly returning the MapDashboard component.
  • Removed the old Home page implementation that included the Navbar and MapDashboard components.

User Experience Enhancements:

  • Created a new NotFound page with a user-friendly message and a link to the main page.

Metadata Improvements:

  • Updated the metadata title to use a template format, improving the consistency of page titles.

Code Cleanup:

  • lib/utils.ts: Removed the areaCodeSchema as it is no longer used.

Other information

None

@fityannugroho fityannugroho added the enhancement New feature or request label Oct 14, 2024
@vercel
Copy link

vercel bot commented Oct 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
idn-area-map ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 7:58am

@fityannugroho fityannugroho merged commit b969b63 into main Oct 14, 2024
@fityannugroho fityannugroho deleted the fix/handling-detail-area-page branch October 14, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant