diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-16 16:46:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-16 16:46:15 +0100 |
commit | 12c8a46362f1f92d1c1a34991a76c55f625a80c6 (patch) | |
tree | 7bd51d84845359d6ce821033b8898687a6ff757f /client/src/app/+about/about-instance/about-instance.component.ts | |
parent | a75eb7489c92869a7ca46d0c484fccdecc3ed7a2 (diff) | |
download | PeerTube-12c8a46362f1f92d1c1a34991a76c55f625a80c6.tar.gz PeerTube-12c8a46362f1f92d1c1a34991a76c55f625a80c6.tar.zst PeerTube-12c8a46362f1f92d1c1a34991a76c55f625a80c6.zip |
Fix about scrolling behaviour
Diffstat (limited to 'client/src/app/+about/about-instance/about-instance.component.ts')
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.component.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index c57ac69ab..bd587fa26 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts | |||
@@ -35,12 +35,13 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
35 | 35 | ||
36 | serverConfig: ServerConfig | 36 | serverConfig: ServerConfig |
37 | 37 | ||
38 | initialized = false | ||
39 | |||
38 | private lastScrollHash: string | 40 | private lastScrollHash: string |
39 | 41 | ||
40 | constructor ( | 42 | constructor ( |
41 | private viewportScroller: ViewportScroller, | 43 | private viewportScroller: ViewportScroller, |
42 | private route: ActivatedRoute, | 44 | private route: ActivatedRoute, |
43 | private serverService: ServerService, | ||
44 | private instanceService: InstanceService | 45 | private instanceService: InstanceService |
45 | ) {} | 46 | ) {} |
46 | 47 | ||
@@ -57,11 +58,9 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
57 | } | 58 | } |
58 | 59 | ||
59 | async ngOnInit () { | 60 | async ngOnInit () { |
60 | this.serverConfig = this.serverService.getTmpConfig() | 61 | const { about, languages, categories, serverConfig }: ResolverData = this.route.snapshot.data.instanceData |
61 | this.serverService.getConfig() | ||
62 | .subscribe(config => this.serverConfig = config) | ||
63 | 62 | ||
64 | const { about, languages, categories }: ResolverData = this.route.snapshot.data.instanceData | 63 | this.serverConfig = serverConfig |
65 | 64 | ||
66 | this.languages = languages | 65 | this.languages = languages |
67 | this.categories = categories | 66 | this.categories = categories |
@@ -73,10 +72,12 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
73 | this.businessModel = about.instance.businessModel | 72 | this.businessModel = about.instance.businessModel |
74 | 73 | ||
75 | this.html = await this.instanceService.buildHtml(about) | 74 | this.html = await this.instanceService.buildHtml(about) |
75 | |||
76 | this.initialized = true | ||
76 | } | 77 | } |
77 | 78 | ||
78 | ngAfterViewChecked () { | 79 | ngAfterViewChecked () { |
79 | if (window.location.hash && window.location.hash !== this.lastScrollHash) { | 80 | if (this.initialized && window.location.hash && window.location.hash !== this.lastScrollHash) { |
80 | this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | 81 | this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) |
81 | 82 | ||
82 | this.lastScrollHash = window.location.hash | 83 | this.lastScrollHash = window.location.hash |