Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(generator): 修复导入json, viewport区域不更新问题 #135

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/generator/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
exportVisibleAtom,
schemaAtom,
headerConfigAtom,
versionAtom,
} from '@generator/store'
import { useSetRecoilState, useRecoilState, useRecoilValue } from 'recoil'
import FileSaver from 'file-saver'
Expand All @@ -34,6 +35,7 @@ const Header = () => {
showExportJSON,
} = useRecoilValue(headerConfigAtom)
const [unitedSchema, setUnitedSchema] = useRecoilState(schemaAtom)
const setVersion = useSetRecoilState(versionAtom)

const importJson = (file: RcFile) => {
return new Promise<void>(() => {
Expand All @@ -46,6 +48,7 @@ const Header = () => {
schema = JSON.parse(e.target.result as string)
}
setUnitedSchema(schema)
setVersion((version) => version + 1)
message.success('上传成功!', 2)
} catch (error) {
message.error('上传失败,请检查文件格式!', 2)
Expand Down