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

update window title when the document name changes #1624

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scytacki
Copy link
Member

@scytacki scytacki commented Nov 15, 2024

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.

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.
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 67.85714% with 9 lines in your changes missing coverage. Please review.

Project coverage is 85.52%. Comparing base (b2424aa) to head (38aafc0).
Report is 126 commits behind head on main.

Files with missing lines Patch % Lines
v3/src/lib/handle-cfm-event.ts 0.00% 8 Missing ⚠️
v3/src/models/app-state.ts 93.75% 1 Missing ⚠️
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              
Flag Coverage Δ
cypress 74.93% <68.00%> (+0.75%) ⬆️
jest 52.55% <50.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cypress bot commented Nov 15, 2024

codap-v3    Run #5219

Run Properties:  status check failed Failed #5219  •  git commit 38aafc0076: add cypress tests for the window.title
Project codap-v3
Branch Review 188104685-update-window-title
Run status status check failed Failed #5219
Run duration 10m 31s
Commit git commit 38aafc0076: add cypress tests for the window.title
Committer Scott Cytacki
View all properties for this run ↗︎

Test results
Tests that failed  Failures 8
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 36
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 210
View all changes introduced in this branch ↗︎

Tests for review

Failed  axis.spec.ts • 7 failed tests • Regression Tests

View Output

Test Artifacts
Test graph axes with various attribute types > will add categorical attribute to x axis and categorical attribute to y axis with undo/redo Test Replay Screenshots
Test graph axes with various attribute types > will add categorical attribute to x axis and numeric attribute to y axis with undo/redo Test Replay Screenshots
Test graph axes with various attribute types > will add numeric attribute to x axis and categorical attribute to y axis with undo/redo Test Replay Screenshots
Test graph axes with various attribute types > will add numeric attribute to x axis and numeric attribute to y axis with undo/redo Test Replay Screenshots
Test graph axes with various attribute types > will split an axis into identical sub axes when categorical attribute is on opposite split Test Replay Screenshots
Test graph axes with various attribute types > will test graph with numeric x-axis and two numeric y-attributes Test Replay Screenshots
Test graph axes with various attribute types > will adjust axis domain when points are changed to bars with undo/redo Test Replay Screenshots
Failed  graph-legend.spec.ts • 1 failed test • Regression Tests

View Output

Test Artifacts
Test changing legend colors > Test changing legend colors for categorical legend > Shows standard 16 grid color palette with extra row for non-standard color Test Replay Screenshots

@scytacki scytacki marked this pull request as ready for review November 15, 2024 22:32
Copy link
Member

@kswenson kswenson left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants