Skip to content

Conversation

@emmadesilva
Copy link
Member

@emmadesilva emmadesilva commented Mar 1, 2024

Changes

Makes some breaking changes to the NavItem class.

Rename protected $destination property to $route

Breaking: Rename NavItem method getDestination to getRoute

Since the destination property in v2 is normalized to always be a route it no longer makes sense to have a divergent name for it.

Breaking: Rename NavItem method isCurrent to isActive

While the method is implemented by using the currentRoute helper, the actual end usage is to compare active state, so it makes more sense for this to use that in the name.

Breaking: Rename NavItem method getGroup to getGroupIdentifier

Renames getGroup() to getGroupIdentifier() to clarify the purpose of the method.

Breaking: Rename NavItem method getLink to getUrl

Renames getLink() to getUrl() for clarity on what the method returns.

@emmadesilva emmadesilva force-pushed the rename-navitem-fields branch from f5ffe93 to cfea2e0 Compare March 1, 2024 14:03
@emmadesilva emmadesilva force-pushed the rename-navitem-fields branch from cfea2e0 to e6c8cc2 Compare March 1, 2024 14:05
Since the destination property in v2 is normalized to always be a route it no longer makes sense to have a divergent name for it.
@codecov
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.95%. Comparing base (3d4f837) to head (f17a412).

❗ Current head f17a412 differs from pull request most recent head 9646b5b. Consider uploading reports for the commit 9646b5b to get more accurate results

Additional details and impacted files
@@                       Coverage Diff                        @@
##             improved-navigation-internals    #1600   +/-   ##
================================================================
  Coverage                            99.95%   99.95%           
  Complexity                            1775     1775           
================================================================
  Files                                  183      183           
  Lines                                 4801     4801           
================================================================
  Hits                                  4799     4799           
  Misses                                   2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

While the method is implemented by using the `currentRoute` helper, the actual end usage is to compare active state, so it makes more sense for this to use that in the name.

   - `isActive()` is more common and may be more intuitive to other developers, as it explicitly suggests that the method is checking if the item is active.
   - `isCurrent()` is also clear, but it might be slightly less common in this context. It still conveys the intended meaning effectively.
@emmadesilva emmadesilva marked this pull request as ready for review March 1, 2024 14:40
Renames `getGroup()` to `getGroupIdentifier()` to clarify the purpose of the method.
Renames `getLink()` to `getUrl()` for clarity on what the method returns.
@emmadesilva emmadesilva force-pushed the rename-navitem-fields branch from 9a2bc51 to f17a412 Compare March 1, 2024 16:02
@emmadesilva emmadesilva merged commit 3bc2e1c into improved-navigation-internals Mar 1, 2024
@emmadesilva emmadesilva deleted the rename-navitem-fields branch March 1, 2024 20:09
@emmadesilva emmadesilva added this to the v2 milestone Jul 9, 2024
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.

2 participants