Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
fix: set modal dialog event handler in useEffect hook
Browse files Browse the repository at this point in the history
  • Loading branch information
harshkhandeparkar committed Nov 18, 2021
1 parent 6fd7d3a commit 51ff965
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/renderer/components/Page/Toolbar/modals/ExportPageModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { MouseEventHandler, useState } from 'react';
import React, { MouseEventHandler, useEffect, useState } from 'react';
import { Icon } from '../../../Icon/Icon';
import { faExclamationCircle } from '@fortawesome/free-solid-svg-icons';
import { Textbox } from '../../../Form/Textbox/Textbox';
Expand Down Expand Up @@ -53,11 +53,13 @@ export const ExportPageModal = (
const [exportDirectory, setExportDirectory] = useState<string | null>(null);
const [errDirNotSelected, setErrDirNotSelected] = useState<boolean>(false);

ipcHandler.addEventHandler(OPEN, 'exportAllOpenHandler', (e, {path, dialogId}) => {
if (dialogId === 1) {
setExportDirectory(path);
setErrDirNotSelected(false);
}
useEffect(() => {
ipcHandler.addEventHandler(OPEN, 'exportAllOpenHandler', (e, {path, dialogId}) => {
if (dialogId === 1) {
setExportDirectory(path);
setErrDirNotSelected(false);
}
})
})

return (
Expand Down

0 comments on commit 51ff965

Please sign in to comment.