-
-
Couldn't load subscription status.
- Fork 6.2k
Update tab title when navigating file tree #35757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find about the JS file tree too.
| buildTitle(oldTreePath: string, treePath: string) { | ||
| // the title always starts with "<repoName>/<treePath>" | ||
| const oldPrefixLength = props.repoName.length + 1 + oldTreePath.length; | ||
| const titleSuffix = document.title.substring(oldPrefixLength); | ||
| return `${props.repoName}/${treePath}${titleSuffix}`; | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really fragile.
I think backend can fully prepare the "title" (ctx.Data["Title"]), pass it to frontend, and frontend only needs to set it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

Fix #35749.