Merged
Conversation
✅ Deploy Preview for kitbag-router ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
pleek91
reviewed
Mar 20, 2026
src/utilities/setDocumentTitle.ts
Outdated
| rejection?: Rejection | null, | ||
| } | ||
|
|
||
| export function setDocumentTitle({ to = null, from = null, rejection = null }: SetDocumentTitleContext): void { |
Contributor
There was a problem hiding this comment.
I'm surprised to see from being passed here but not used for the route version. IMO we might want to standardize this around calling getTitle on both rather than using to.title and rejection.getTitle. just for consistency.
Also I think we should separate out the logic for determining what the title should be and setting the document title. This utility is doing double duty.
Contributor
Author
There was a problem hiding this comment.
I've pivoted this PR quite a bit, I don't think this still applies but I'll leave it open for you to make that call
Move rejection component
craig-pplx
approved these changes
Mar 23, 2026
pleek91
approved these changes
Mar 23, 2026
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.
this PR adds the
setTitleparadigm to rejections that mostly mirrors how routes can set document.title.unlike
route, rejection doesn't havetitle: Promise<string | undefined>because there's no good point to convert that fromgetRoute()to an executed promise. Route does this when it gets translated fromRoutetoResolvedRoute, but we don't have the concept ofResolvedRejection.the arguments are also different. Rejection setTitle callback is given only
SetRejectionTitleContext, which looks likeNote that
toandfromare only populated when the rejection happens as part of navigation. If the rejection is the result ofrouter.reject(...), then both to and from will benull.