Skip to content

Commit 8904f46

Browse files
committed
Add event callbacks for explorers
1 parent ba4872f commit 8904f46

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-ide-interface",
3-
"version": "0.1.60",
3+
"version": "0.1.61",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"files": [

src/components/Explorer/Explorer.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
ResetIcon,
2020
RenameIcon,
2121
} from "Assets";
22-
import { useError, useTheme } from "Utils";
22+
import { subscribe, unsubscribe, useError, useTheme } from "Utils";
2323
import {
2424
StyledSidebarContainer,
2525
StyledSidebarEntry,
@@ -70,6 +70,14 @@ const Explorer = ({
7070
updateSelectedLocation(undefined);
7171
}, [selectedEntry]);
7272

73+
useEffect(() => {
74+
subscribe(`updateExplorer-${api.name}`, fetchFileList);
75+
76+
return () => {
77+
unsubscribe(`updateExplorer-${api.name}`, () => {});
78+
};
79+
}, []);
80+
7381
// useEffect(() => {
7482
// if (forceUpdate.value) {
7583
// forceUpdate.callback(false);

src/components/Modals/Modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ export const ModalEditableList = ({
306306
export const ModalActionList = ({
307307
list,
308308
title,
309-
onSelect,
309+
selected,
310310
}: {
311311
list: { name: string; component: JSX.Element }[];
312312
title?: string;
313-
onSelect: (event: any, entry: string) => void;
313+
selected: string;
314314
}) => {
315315
const theme = useTheme();
316316
const [isOpen, open] = useState<string | undefined>(undefined);

0 commit comments

Comments
 (0)