-
Notifications
You must be signed in to change notification settings - Fork 39
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
update window title when the document name changes #1624
base: main
Are you sure you want to change the base?
Conversation
This replaces the document title in the document state with a volatile title property. It also removes the filename from the properties. Both changes are intended to force the CFM to be the source of truth for the title. This change of state should not require a migration of existing v3 documents because the filename/name was already managed by the CFM and just not updated in v3 correctly. To keep the title in sync the filename needs to be processed when the CFM sends the openedFile, savedFile, and renamedFile events.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1624 +/- ##
==========================================
+ Coverage 85.02% 85.52% +0.50%
==========================================
Files 600 601 +1
Lines 30307 30417 +110
Branches 7740 7779 +39
==========================================
+ Hits 25768 26014 +246
+ Misses 4384 4248 -136
Partials 155 155
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
👍 LGTM -- just a few suggestions
if (key === "filename") { | ||
// We don't save the filename because it is redundant with the filename in the actual | ||
// filesystem. | ||
// However we need to the extension-less name for the window title |
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.
// However we need to the extension-less name for the window title | |
// However we need the extension-less name for the window title. |
or something like that.
@@ -42,6 +44,7 @@ class AppState { | |||
private version = "" | |||
private cfm: CloudFileManager | undefined | |||
private dirtyMonitorDisposer: (() => void) | undefined | |||
titleMonitorDisposer: any |
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.
titleMonitorDisposer: any | |
private titleMonitorDisposer: (() => void) | undefined |
@@ -29,6 +29,7 @@ interface IOptions { | |||
} | |||
export function createCodapDocument(snapshot?: ICodapDocumentModelSnapshot, options?: IOptions): IDocumentModel { | |||
const { layout = "free", noGlobals = false } = options || {} | |||
// Note: The version and build will not be updated after the document is first created |
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.
Can/should we do something about that? Seems like the expectation would be that it would be the version that most recently saved it.
This replaces the document title in the document state with a volatile title property. It also removes the filename from the properties. Both changes are intended to force the CFM to be the source of truth for the title.
This change of state should not require a migration of existing v3 documents because the filename/name was already managed by the CFM and just not updated in v3 correctly.
To keep the title in sync the filename needs to be processed when the CFM sends the openedFile, savedFile, and renamedFile events.