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

fix(nav): getLength is part of the public API #28832

Merged
merged 4 commits into from Jan 16, 2024
Merged

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Jan 15, 2024

Issue number: resolves #28826


What is the current behavior?

getLength used to be a public method on ion-nav. However, the @Method decorator was removed in 1d46973#diff-4b2ac275268173207c99a590b0ced8b67dc3d697815eb51a3c0546ee7cb0c0aeR429-L445.

While the removal of @Method from isAnimating was likely intentional, the team thinks that removing it from getLength was an accident. Otherwise, it's challenging to call methods like removeIndex if you don't know how many items are in the stack. For example, if a developer wants to remove the second to last item, they need to know how many items are in the stack so they don't give an index that is out of bounds.

What is the new behavior?

  • getLength is now a public method

Does this introduce a breaking change?

  • Yes
  • No

The team is considering this to be a breaking change. As part of this, getLength must return Promise<number> instead of number as all public methods must return promises. While this API wasn't documented by mistake, it's technically always been a public API. As a result, JS-only developers can access getLength synchronously and TypeScript developers can do the same if they typecast Nav as any. Given that the return signature is different, we are going to ship this in a major release.

Other information

@github-actions github-actions bot added the package: core @ionic/core package label Jan 15, 2024
@liamdebeasi liamdebeasi changed the title Fw 5890 fix(nav): getLength is part of the public API Jan 15, 2024
@liamdebeasi liamdebeasi marked this pull request as ready for review January 15, 2024 21:59
@liamdebeasi liamdebeasi requested review from sean-perkins and a team as code owners January 15, 2024 21:59
@liamdebeasi liamdebeasi merged commit 4fd05b6 into feature-8.0 Jan 16, 2024
44 checks passed
@liamdebeasi liamdebeasi deleted the FW-5890 branch January 16, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants