Skip to content

Commit

Permalink
fix(scrollTo): reset actualAnchor on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Balet committed Apr 24, 2024
1 parent ea98dc0 commit 6058354
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-href",
"version": "17.3.0",
"version": "17.4.0",
"license": "MIT",
"author": "Raphael Balet",
"maintainers": [
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-href/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-href",
"version": "17.3.0",
"version": "17.4.0",
"license": "MIT",
"author": {
"name": "Raphaël Balet",
Expand Down
8 changes: 5 additions & 3 deletions projects/ngx-href/src/lib/href.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ export class NgxHrefService {
scrollTo(anchor?: string, counter = 0) {
if (
!anchor ||
counter >= 10 || // Counter over, this element doesn't exist or the page is too slow
(anchor === this._actualAnchor && counter === 0) // Multiple click on the same url
)
counter >= 10 // Counter over, this element doesn't exist or the page is too slow
) {
this._actualAnchor = undefined
return
}
if (anchor === this._actualAnchor && counter === 0) return // Multiple click on the same url

if (counter === 0) {
this.setAnchor(anchor)
Expand Down

0 comments on commit 6058354

Please sign in to comment.