Skip to content

Commit

Permalink
Remove unnecessary optional chaining — currentLocation is always defined
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Aug 26, 2024
1 parent fe16bbf commit c8a3f44
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function goTo(
...restOptions
} = options;

if ( currentLocation?.path === path ) {
if ( currentLocation.path === path ) {
return { currentLocation, focusSelectors };
}

Expand All @@ -92,7 +92,7 @@ function goTo(

// Set a focus selector that will be used when navigating
// back to the current location.
if ( focusTargetSelector && currentLocation?.path ) {
if ( focusTargetSelector && currentLocation.path ) {
getFocusSelectorsCopy().set(
currentLocation.path,
focusTargetSelector
Expand Down Expand Up @@ -130,7 +130,7 @@ function goToParent(
) {
const { screens, focusSelectors } = state;
const currentLocation = { ...state.currentLocation, isInitial: false };
const currentPath = currentLocation?.path;
const currentPath = currentLocation.path;
if ( currentPath === undefined ) {
return { currentLocation, focusSelectors };
}
Expand Down Expand Up @@ -186,7 +186,7 @@ function routerReducer(
}

// Compute the matchedPath
const currentPath = currentLocation?.path;
const currentPath = currentLocation.path;
matchedPath =
currentPath !== undefined
? patternMatch( currentPath, screens )
Expand Down

0 comments on commit c8a3f44

Please sign in to comment.