Skip to content

Commit

Permalink
Navigator: fix isInitial logic (#65527)
Browse files Browse the repository at this point in the history
* Navigator: fix isInitial logic

* CHANGELOG

---

Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Sep 24, 2024
1 parent 2a80118 commit efd622d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bug Fixes

- `ToolsPanel`: atomic one-step state update when (un)registering panels ([#65564](https://github.com/WordPress/gutenberg/pull/65564)).
- `Navigator`: fix `isInitial` logic ([#65527](https://github.com/WordPress/gutenberg/pull/65527)).

## 28.8.0 (2024-09-19)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function goTo(
options: NavigateOptions = {}
) {
const { focusSelectors } = state;
const currentLocation = { ...state.currentLocation, isInitial: false };
const currentLocation = { ...state.currentLocation };

const {
// Default assignments
Expand Down Expand Up @@ -114,6 +114,7 @@ function goTo(
return {
currentLocation: {
...restOptions,
isInitial: false,
path,
isBack,
hasRestoredFocus: false,
Expand All @@ -129,7 +130,7 @@ function goToParent(
options: NavigateToParentOptions = {}
) {
const { screens, focusSelectors } = state;
const currentLocation = { ...state.currentLocation, isInitial: false };
const currentLocation = { ...state.currentLocation };
const currentPath = currentLocation.path;
if ( currentPath === undefined ) {
return { currentLocation, focusSelectors };
Expand Down

0 comments on commit efd622d

Please sign in to comment.