Minor fixes to GrTopicView

Change-Id: I205ed316b03c2813c3fa609fe1ddc5c5f0d7cc36
diff --git a/polygerrit-ui/app/elements/gr-app-element_html.ts b/polygerrit-ui/app/elements/gr-app-element_html.ts
index fcc742c..34c6a35 100644
--- a/polygerrit-ui/app/elements/gr-app-element_html.ts
+++ b/polygerrit-ui/app/elements/gr-app-element_html.ts
@@ -131,7 +131,7 @@
         view-state="{{_viewState.dashboardView}}"
       ></gr-dashboard-view>
     </template>
-    <template is="dom-if" if="[[_showTopicView]]" restamp="true">
+    <template is="dom-if" if="[[_showTopicView]]">
       <gr-topic-view params="[[params]]"></gr-topic-view>
     </template>
     <!-- Note that the change view does not have restamp="true" set, because we
diff --git a/polygerrit-ui/app/elements/topic/gr-topic-view.ts b/polygerrit-ui/app/elements/topic/gr-topic-view.ts
index de5ee84..be57885 100644
--- a/polygerrit-ui/app/elements/topic/gr-topic-view.ts
+++ b/polygerrit-ui/app/elements/topic/gr-topic-view.ts
@@ -1,10 +1,3 @@
-import {customElement, property, state} from 'lit/decorators';
-import {LitElement, html, PropertyValues} from 'lit';
-import {AppElementTopicParams} from '../gr-app-types';
-import {appContext} from '../../services/app-context';
-import {KnownExperimentId} from '../../services/flags/flags';
-import {GerritNav} from '../core/gr-navigation/gr-navigation';
-
 /**
  * @license
  * Copyright (C) 2021 The Android Open Source Project
@@ -22,6 +15,14 @@
  * limitations under the License.
  */
 
+import {customElement, property, state} from 'lit/decorators';
+import {LitElement, html, PropertyValues} from 'lit';
+import {AppElementTopicParams} from '../gr-app-types';
+import {appContext} from '../../services/app-context';
+import {KnownExperimentId} from '../../services/flags/flags';
+import {GerritNav} from '../core/gr-navigation/gr-navigation';
+import {GerritView} from '../../services/router/router-model';
+
 @customElement('gr-topic-view')
 export class GrTopicView extends LitElement {
   @property()
@@ -32,7 +33,7 @@
 
   private readonly flagsService = appContext.flagsService;
 
-  override updated(changedProperties: PropertyValues) {
+  override willUpdate(changedProperties: PropertyValues) {
     if (changedProperties.has('params')) {
       this.paramsChanged();
     }
@@ -43,6 +44,7 @@
   }
 
   paramsChanged() {
+    if (this.params?.view !== GerritView.TOPIC) return;
     this.topic = this.params?.topic;
     if (
       !this.flagsService.isEnabled(KnownExperimentId.TOPICS_PAGE) &&
@@ -52,3 +54,9 @@
     }
   }
 }
+
+declare global {
+  interface HTMLElementTagNameMap {
+    'gr-topic-view': GrTopicView;
+  }
+}
diff --git a/polygerrit-ui/app/services/router/router-model.ts b/polygerrit-ui/app/services/router/router-model.ts
index b8b385a..584b8d7 100644
--- a/polygerrit-ui/app/services/router/router-model.ts
+++ b/polygerrit-ui/app/services/router/router-model.ts
@@ -60,6 +60,7 @@
 
 // Must only be used by the router service or whatever is in control of this
 // model.
+// TODO: Consider keeping params of type AppElementParams entirely in the state
 export function updateState(
   view?: GerritView,
   changeNum?: NumericChangeId,