joye61 / pic-smaller

Pic Smaller – Compress JPEG, PNG, WEBP, AVIF, SVG and GIF images intelligently
https://picsmaller.com
MIT License
2.16k stars 307 forks source link

Refactor: Cleanup and Rename Router Initialization Logic #28

Closed ramen-curator closed 5 months ago

ramen-curator commented 6 months ago

Overview

This pull request includes two refactoring changes aimed at improving the clarity and structure of the routing logic within our codebase. The changes involve removing unnecessary export keywords and renaming functions to better reflect their purposes.

Changes

  1. Remove Unnecessary Export

    • The showPageByPath function in src/history.tsx was previously exported but is now used only within the module. This commit removes the export keyword, simplifying the interface and reducing potential external dependencies.
    • Commit: refactor: del unnecessary 'export' for 'showPageByPath'
  2. Rename Function for Clarity

    • The function initially named initHistoryLogic has been renamed to initRouter to more accurately describe its role in initializing the routing system.
    • This change affects both src/Initial.tsx and src/history.tsx, updating import statements and function calls to reflect the new name.
    • Commit: refactor: rename initHistoryLogic to initRouter

Rationale

These changes are intended to enhance the readability and maintainability of our routing logic. By removing unnecessary exports, we keep our module interfaces clean and focused. Renaming initHistoryLogic to initRouter provides clarity on the function's purpose, making the codebase easier to understand and navigate for new developers and reviewers alike.

Please review the proposed changes and provide feedback or approval at your earliest convenience. Thank you!

vercel[bot] commented 6 months ago

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

Name Status Preview Comments Updated (UTC)
pic-smaller ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2024 10:32am
ramen-curator commented 5 months ago

@joye61 Hi,

I have made additional changes to this branch and added three new commits. Here are the details:

commit 1: Refactor routing logic

commit 2: Extract query string building and navigation logic

commit 3: Enhance reliability of query string building

These changes aim to improve the readability, maintainability, and reliability of the code. I hope these updates further enhance the project. If you have any questions or need any modifications, please let me know.

Thank you!