Skip to content

Conversation

@ShreyanshK1103
Copy link

@ShreyanshK1103 ShreyanshK1103 commented Nov 15, 2025

Summary

This pull request fixes the desktop application's window title synchronization behavior.
Previously, the title did not always update when opening, editing, saving, or closing a model, and it was not reset when navigating back to the dashboard via the navbar logo.

What Was Changed

Removed the unused updateTitle IPC bridge as requested in review

Reused existing IPC channels (modelOpened, modelClosed) instead of adding new preload functions

Corrected title handling in desktop.js to properly call setTitle / setRepresentedFilename

Ensured the title updates when:

  • opening a model

  • editing a model

  • saving a model

navigating between ThreatModel and ThreatModelEdit

Added title reset when clicking the Threat Dragon logo (navigating home)

Cleaned up inconsistent naming and removed accidental typos introduced in prior iterations

How Threat Dragon Worked Before

Titles were sometimes stale or incorrect

Returning to the dashboard did not reset the window title

A new IPC (updateTitle) was added but was unnecessary and removed during review

The existing flow used modelOpened for title updates, but the implementation was incomplete and inconsistent

How It Works Now

All title changes pass through existing IPC methods

The title always reflects the current model’s name

Returning to the dashboard resets to the default title

Behavior is now consistent across all pages

Testing

Functional behavior verified manually across:

model open

model edit + save

model close

navigation back to dashboard

No changes to unit tests were required as functionality was restored, not extended

Issue Reference

This PR addresses: #1312

AI Assistance Disclosure

AI assistance was used only for drafting explanatory text and structuring this PR description.
All code changes were manually written, tested, and validated.

ShreyanshK1103 added 7 commits November 13, 2025 08:39
- Added IPC channel update-title
- Updated title on open, close, save rename
- Reset title on Home and Dashboard navigation
- Added macOS-specific window title handling
- Exposed updateTitle in preload
- Electron: IPC-based title updates
- Reset title on dashboard and logo navigation
- Rename updates title only after save
- Web version: setPageTitle utility added
- Full navigation consistency ensured
@jgadsden
Copy link
Collaborator

@ShreyanshK1103 do not worry about the failed pipeline test, issue #1380

@ShreyanshK1103
Copy link
Author

@jgadsden
Hello, I’m following up to see if any changes are needed on this PR. Please let me know. Thank you.

@jgadsden jgadsden marked this pull request as draft November 24, 2025 08:58
Copy link
Collaborator

@jgadsden jgadsden left a comment

Choose a reason for hiding this comment

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

Hello @ShreyanshK1103 , good to see new functionality being added
There are some points to consider:

  • does there need to be a new function in the context bridge? The (relevant) existing functions already inform electron and the renderer of the filename after on file save
  • you have not used the pull request template, which contains checkboxes for stating that you have created tests and also that you have declared any use of AI
  • we have a contributors guide that sets out the acceptable use of AI here:
    https://github.com/OWASP/threat-dragon/blob/main/contributing.md#use-of-ai

@ShreyanshK1103
Copy link
Author

@jgadsden
Thank you for the review.

I’ll update the PR based on your points:

I will remove the new contextBridge function and instead use the existing IPC events such as model-opened to update the window title.

I will revise the Electron side to update the title within the existing handlers instead of introducing a new channel.

I will update the PR to follow the pull request template and include the required AI use declaration.

I’ll push the revised changes shortly.

- Routed all title updates through existing modelOpened/modelClosed IPC
- Synced title on model open, save, and view navigation
- Reset title when clicking the Threat Dragon logo (home navigation)
@ShreyanshK1103
Copy link
Author

Let me know if you’d like any changes or adjustments. Happy to update the PR.

@jgadsden
Copy link
Collaborator

jgadsden commented Dec 6, 2025

Let me know if you’d like any changes or adjustments. Happy to update the PR.

yes, if you could do the changes that would be appreciated

@jgadsden
Copy link
Collaborator

jgadsden commented Dec 9, 2025

@ShreyanshK1103 please follow the restrictions on the use of (generative) AI that all our contributors to pull requests + issues + comments are required to follow

Copy link
Collaborator

@jgadsden jgadsden left a comment

Choose a reason for hiding this comment

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

Hello @ShreyanshK1103

  • did you use AI for this implementation ? You must use the PR template and provide the declarations
  • the electron server is made aware of changes to the file name and when the file is closed, and is able to change the title bar
  • the window title is only to be changed for the desktop app using electron, so there does not seem to be any reason for the renderer to change the title
  • test cases should be provided for this new feature

@ShreyanshK1103
Copy link
Author

Hello @jgadsden,

Apologies for the delay — I’ve had final exams this week.

Thanks for the feedback. I understand that the title update should rely on the existing Electron flow and remain desktop-only. I’ll revise the implementation accordingly, rebase onto the latest main branch, and add the required tests before updating the PR.

Actually the tests failed due to a small mistake from my side I did not pull the latest changes while coding the solution which neglected the latest tests.

And for the template I will use the mentioned one where the use of AI is stated , as I used AI only for writing of the PR template.

I will quickly look onto it as my exams are over now.

Thank you for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants