Skip to content

Commit

Permalink
fix open widget
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-hackin committed Sep 12, 2024
1 parent be98a15 commit 918b3e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/svg-widget-studio/src/components/FileInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import { InvisibleTextFileInput } from './InvisibleTextFileInput';

export const FileInputs = observer(() => {
const workspaceStore = useWorkspaceMst();
const { openWidgetFileFlag, deactivateWidgetFilePicker } = workspaceStore.dialogManager;
const { dialogManager } = workspaceStore;

const openWidgetInputRef = useRef<HTMLInputElement>(null);

useEffect(() => {
if (openWidgetFileFlag) {
if (dialogManager.openWidgetFileFlag) {
openWidgetInputRef?.current?.click();
}
}, [openWidgetFileFlag]);
}, [dialogManager.openWidgetFileFlag]);

return (
<InvisibleTextFileInput
ref={openWidgetInputRef}
changeHandler={(txt) => {
deactivateWidgetFilePicker();
dialogManager.deactivateWidgetFilePicker();
workspaceStore.initializeWidgetFromSnapshot(JSON.parse(txt));
}}
accept={`.${WIDGET_EXT}`}
Expand Down

0 comments on commit 918b3e6

Please sign in to comment.