Conversation
`GuideViewer` subscribed to the route params to resolve the current guide, but only set the page title once in `ngOnInit`. Since the router reuses the component when only the `:id` param changes, navigating from one guide to another in-app would update the rendered guide while leaving the browser title pointing at the previous one. This isn't reachable today because guide-to-guide links in the markdown are absolute URLs that trigger a full page load, but it would surface as soon as an in-app link between guides is added. Changes: - Set the page title inside the params subscription, next to where the guide is resolved, so both stay in sync on every param emission. - Remove the now-redundant `ngOnInit` and the `OnInit` interface. - Tie the params subscription to the component's lifetime with `takeUntilDestroyed()`, matching the pattern used in `ComponentViewer`. - Switch the spec's mocked `params` to a `BehaviorSubject` and add tests covering the initial title and the title after a param change.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
GuideViewersubscribed to the route params to resolve the current guide, but only set the page title once inngOnInit. Since the router reuses the component when only the:idparam changes, navigating from one guide to another in-app would update the rendered guide while leaving the browser title pointing at the previous one.This isn't reachable today because guide-to-guide links in the markdown are absolute URLs that trigger a full page load, but it would surface as soon as an in-app link between guides is added.
Changes:
ngOnInitand theOnInitinterface.takeUntilDestroyed(), matching the pattern used inComponentViewer.paramsto aBehaviorSubjectand add tests covering the initial title and the title after a param change.