Skip to content
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

refactor(packages): simplify and clarify overlay-related types and constants #92

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Nov 26, 2024

Description

this pull request refactors and standardizes the overlay store and event handling logic for improved type safety, maintainability, and clarity. the following changes have been applied across multiple files to ensure consistent usage of types and improve the developer experience.

Changes

general improvements

  • standardized the use of overlayItem['id'] for overlayid across all relevant files. this ensures type consistency and eliminates redundant type definitions.
  • updated function and variable names for clarity and to better reflect their purpose.

file-specific changes

store.ts

  • renamed overlayId to overlayItemId for better semantic clarity.
  • changed overlayData to overlayState to align with its usage as the application’s overlay state.
  • refactored variable names:
    • overlayOrderListorderIds
    • overlayDatadata
  • updated the store registration object:
    • registerOverlaysStoreregisterOverlayStore

use-sync-overlay-store.ts

  • adjusted for changes in the store export:
  • updated registerOverlaysStore to registerOverlayStore.

event.ts

  • standardized overlayId type to overlayItem['id'] in all related function definitions:
    • open
    • openAsync
    • close
    • unmount
  • dispatch actions for closing and unmounting overlays now leverage the standardized type.
  • improved function comments for better readability and documentation.

Motivation and Context

this refactor improves the overall maintainability and type safety of the overlay system:

  • consistency: reusing overlayItem['id'] ensures that all references to id maintain a single source of truth.
  • clarity: updated names like overlayDataoverlayState and overlayOrderListorderIds make the codebase easier to understand and navigate.
  • maintainability: by reducing redundant type definitions and centralizing type usage, future changes to overlay-related types will require minimal updates.

this change is part of a larger effort to enhance code quality and maintainability across the project.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have performed a self-review of my own code.
  • My code is commented, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Further Comments

this refactor does not introduce new functionality but focuses on improving the maintainability and readability of the overlay system. any future changes to the overlay store or related logic will benefit from the increased type safety and consistency established in this pr.

@sukvvon sukvvon requested a review from jungpaeng as a code owner November 26, 2024 07:40
Copy link

changeset-bot bot commented Nov 26, 2024

⚠️ No Changeset found

Latest commit: b5d0f55

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 26, 2024

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

Name Status Preview Comments Updated (UTC)
overlay-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 4:40am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant