Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 16 additions & 4 deletions src/extensions/default/Git/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ define(function (require, exports) {
gitPanel.setVisible(bool);

// Mark menu item as enabled/disabled.
CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL).setChecked(bool);
_setTogglePanelChecked(bool);

if (bool) {
$("#git-toolbar-icon").removeClass("forced-hidden");
Expand Down Expand Up @@ -1510,21 +1510,33 @@ define(function (require, exports) {
handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.DEFAULT);
});

// The toggle-panel command is registered in the extension's init flow.
// These workspace-panel events can fire during project-open before
// init has run (race during boot), so CommandManager.get can return
// undefined — the menu just hasn't been wired up yet. Skip the
// setChecked call in that window; init will sync state on its own.
function _setTogglePanelChecked(bool) {
const command = CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL);
if (command) {
command.setChecked(bool);
}
}

// When the panel tab is closed externally (e.g. via the × button),
// update the toolbar icon and menu checked state to stay in sync.
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
if (panelID === "main-git.panel" && gitPanel) {
Main.$icon.toggleClass("on", false);
Main.$icon.toggleClass("selected-button", false);
CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL).setChecked(false);
_setTogglePanelChecked(false);
Preferences.set("panelEnabled", false);
}
// When the bottom panel container is collapsed, deselect the icon
// but don't save preference — the panel is still logically open.
if (panelID === WorkspaceManager.DEFAULT_PANEL_ID && Main.$icon) {
Main.$icon.toggleClass("on", false);
Main.$icon.toggleClass("selected-button", false);
CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL).setChecked(false);
_setTogglePanelChecked(false);
}
});

Expand All @@ -1535,7 +1547,7 @@ define(function (require, exports) {
const isGitActive = (panelID === "main-git.panel");
Main.$icon.toggleClass("on", isGitActive);
Main.$icon.toggleClass("selected-button", isGitActive);
CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL).setChecked(isGitActive);
_setTogglePanelChecked(isGitActive);
});

exports.init = init;
Expand Down
2 changes: 1 addition & 1 deletion tracking-repos.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"phoenixPro": {
"commitID": "cc421cb18c699ff30d1a886b952e5518efd79b48"
"commitID": "644be1987bcca30f3fad0be0515cc763b42dc4c0"
}
}
Loading