Skip to content

Commit

Permalink
fix: file input reset
Browse files Browse the repository at this point in the history
  • Loading branch information
notmedia committed Aug 21, 2022
1 parent a820ad6 commit 77004fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/components/file-input/file.input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';

export type FileInputProps = Partial<Omit<InputProps, 'type' | 'value' | 'onChange'>> & {
buttonColor?: NormalColors;
value?: string | undefined;
value?: string | null | undefined;

onChange: (path: string | undefined) => void;
};
Expand All @@ -20,6 +20,10 @@ export const FileInput = React.forwardRef<HTMLInputElement, FileInputProps>(
({ accept, buttonColor, onChange, value, readOnly = false, ...props }, ref) => {
const [inputValue, setInputValue] = React.useState(value);

React.useEffect(() => {
setInputValue(value);
}, [value]);

const handleDialogOpenButtonClick = async () => {
const paths = await window.electronDialog.open({ properties: ['openFile'] });

Expand Down

0 comments on commit 77004fd

Please sign in to comment.