Skip to content
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

Fix #1428 - Update Browser Tab Title When Notebook is Renamed #1496

Merged
merged 4 commits into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion frontend/src/core/edit-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ export const EditApp: React.FC<AppProps> = ({ userConfig, appConfig }) => {
}
});

return sendRename(name)
return sendRename(name)
.then(() => {
setFilename(name);
// Set document title: app_title takes precedence, then filename, then default
document.title = appConfig.app_title || name || "Untitled Notebook";
return name;
})
.catch((error) => {
Expand All @@ -126,6 +128,12 @@ export const EditApp: React.FC<AppProps> = ({ userConfig, appConfig }) => {
});
});

// Update document title whenever filename or app_title changes
useEffect(() => {
// Set document title: app_title takes precedence, then filename, then default
document.title = appConfig.app_title || filename || "Untitled Notebook";
}, [appConfig.app_title, filename]);

const cells = notebookCells(notebook);
const cellIds = cells.map((cell) => cell.id);
const codes = cells.map((cell) => cell.code);
Expand Down
Loading