fix(nav): getLength is part of the public API #28832
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue number: resolves #28826
What is the current behavior?
getLength
used to be a public method onion-nav
. However, the@Method
decorator was removed in 1d46973#diff-4b2ac275268173207c99a590b0ced8b67dc3d697815eb51a3c0546ee7cb0c0aeR429-L445.While the removal of
@Method
fromisAnimating
was likely intentional, the team thinks that removing it fromgetLength
was an accident. Otherwise, it's challenging to call methods likeremoveIndex
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 methodDoes this introduce a breaking change?
The team is considering this to be a breaking change. As part of this,
getLength
must returnPromise<number>
instead ofnumber
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 accessgetLength
synchronously and TypeScript developers can do the same if they typecast Nav asany
. Given that the return signature is different, we are going to ship this in a major release.Other information