Skip to content

Commit 4e3abf7

Browse files
committed
automatically refresh tray on complete install
1 parent f6ae11a commit 4e3abf7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/context-menu/TrayContextMenu.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ export interface TrayContextMenuProps {
1313
visible: boolean;
1414
libraryName: string;
1515
status: string;
16+
refreshTrigger: () => void;
1617
onClose: () => void;
1718
}
1819

19-
const TrayContextMenu = ({ app, x, y, visible, libraryName, status, onClose }: TrayContextMenuProps) => {
20+
const TrayContextMenu = ({ app, x, y, visible, libraryName, status, refreshTrigger, onClose }: TrayContextMenuProps) => {
2021
const trayContextMenuRef = useRef(null);
2122
const [validOptions, setValidOptions] = useState({
2223
showInFileBrowser: false,
@@ -67,7 +68,7 @@ const TrayContextMenu = ({ app, x, y, visible, libraryName, status, onClose }: T
6768
}, []);
6869

6970
// Context menu action handlers
70-
const handleInstall = async (libraryName) => {
71+
const handleInstall = async (libraryName, refreshTrigger) => {
7172
const userResponse = confirm(`Do you want to proceed with ${libraryName} library installation?`);
7273
if (userResponse) {
7374
try {
@@ -90,6 +91,7 @@ const TrayContextMenu = ({ app, x, y, visible, libraryName, status, onClose }: T
9091
} else {
9192
alert(`Library configuration not found for: ${libraryName}`);
9293
}
94+
refreshTrigger();
9395
} catch (error) {
9496
alert(`Failed to install ${libraryName}. Please check the console for more details.`);
9597
console.error(`Failed to install ${libraryName}:`, error);
@@ -151,7 +153,7 @@ const TrayContextMenu = ({ app, x, y, visible, libraryName, status, onClose }: T
151153
<div className="context-menu" ref={trayContextMenuRef} style={{ position: 'absolute', left: `${x+5}px`, top: `${y}px`, zIndex: 1000 }}>
152154
{status === 'remote' ? (
153155
<>
154-
<div className="context-menu-option" onClick={() => { handleInstall(libraryName); onClose(); }}>Install</div>
156+
<div className="context-menu-option" onClick={() => { handleInstall(libraryName, refreshTrigger); onClose(); }}>Install</div>
155157
{validOptions.showPageInNewTab && (
156158
<div className="context-menu-option" onClick={() => { handleShowPageInNewTab(libraryName); onClose(); }}>Open Repository</div>
157159
)}

src/tray_library/Sidebar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export default function Sidebar(props: SidebarProps) {
274274
visible={contextMenuState.visible}
275275
libraryName={contextMenuState.libraryName}
276276
status={contextMenuState.status}
277+
refreshTrigger={handleRefreshOnClick}
277278
onClose={closeContextMenu}
278279
/>
279280
</Body>

0 commit comments

Comments
 (0)