Skip to content

Remove dependency on parent-id and directly extract from the url#3355

Merged
ildyria merged 1 commit intomasterfrom
refactoring-parent-id
May 28, 2025
Merged

Remove dependency on parent-id and directly extract from the url#3355
ildyria merged 1 commit intomasterfrom
refactoring-parent-id

Conversation

@ildyria
Copy link
Copy Markdown
Member

@ildyria ildyria commented May 17, 2025

This pull request refactors the handling of parentId in various Vue components by replacing the parentId prop with a new getParentId method from the usePhotoRoute composable. This change simplifies the codebase by centralizing the logic for determining the current parent album ID and removes the need to pass parentId as a prop across multiple components. Additionally, minor improvements and cleanups are included.

Refactoring of parentId handling:

  • Centralized parentId logic:

    • Introduced the getParentId method in the usePhotoRoute composable to fetch the current album ID from the router's currentRoute params. [1] [2]
    • Updated components such as AlbumCreateDialog, AlbumMergeDialog, DeleteDialog, MoveDialog, and others to use getParentId instead of relying on the parentId prop. [1] [2] [3] [4] [5]
  • Removal of parentId prop:

    • Removed the parentId prop from components where it was previously passed, simplifying their interfaces. [1] [2] [3] [4]
  • Updated service calls:

    • Replaced direct references to parentId with calls to getParentId in service methods like album creation, deletion, moving, and merging. [1] [2] [3] [4] [5]

Code cleanup and minor improvements:

  • Improved PhotoService.move method:

    • Refactored the PhotoService.move method to accept a structured PhotoMove object for better clarity and type safety. [1] [2]
  • Removed unnecessary watchers:

    • Removed watchers on props.parentId that are no longer needed due to the centralized getParentId logic.
  • UI adjustments:

    • Removed unused parentId bindings in templates across various components, reducing redundancy. [1] [2] [3]

This refactor improves maintainability by consolidating logic, reducing prop dependencies, and simplifying component interfaces.

@ildyria ildyria requested a review from a team as a code owner May 17, 2025 19:07
@ildyria ildyria added the Review: easy Easy review expected: probably just need a quick to go through. label May 17, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.99%. Comparing base (a921383) to head (3703cc3).

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria force-pushed the refactoring-parent-id branch from 3703cc3 to e813c38 Compare May 26, 2025 19:27
@ildyria ildyria force-pushed the refactoring-parent-id branch from e813c38 to 273a3f3 Compare May 28, 2025 16:44
@ildyria ildyria merged commit 50e467b into master May 28, 2025
34 checks passed
@ildyria ildyria deleted the refactoring-parent-id branch May 28, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: easy Easy review expected: probably just need a quick to go through.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants