-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
refactor: snapshot store to diff #3155
base: v4.8.14-dev
Are you sure you want to change the base?
Conversation
projects/app/src/pages/app/detail/components/WorkflowComponents/context/index.tsx
Outdated
Show resolved
Hide resolved
projects/app/src/pages/app/detail/components/WorkflowComponents/context/index.tsx
Outdated
Show resolved
Hide resolved
projects/app/src/pages/app/detail/components/WorkflowComponents/context/index.tsx
Show resolved
Hide resolved
projects/app/src/pages/app/detail/components/WorkflowComponents/context/index.tsx
Outdated
Show resolved
Hide resolved
projects/app/src/pages/app/detail/components/WorkflowComponents/context/index.tsx
Show resolved
Hide resolved
projects/app/src/pages/app/detail/components/WorkflowComponents/context/index.tsx
Outdated
Show resolved
Hide resolved
projects/app/src/pages/app/detail/components/SimpleApp/useSnapshots.tsx
Outdated
Show resolved
Hide resolved
structuredClone(initialAppForm), | ||
savedSnapshot?.diff | ||
) as AppSimpleEditFormType; | ||
const val = compareSimpleAppSnapshot(pastState, appForm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接看,diff 是不是空的,应该就能知道了吧?不需要再比一次。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
保存的diff是和initialAppForm比的,这里应该得判断pastState和appForm的diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialAppForm 不就是记录开始编辑的状态么?这里计算的是,是否保存,就是指,跟最初状态比。
projects/app/src/pages/app/detail/components/SimpleApp/Header.tsx
Outdated
Show resolved
Hide resolved
patch 方法封装起来,直接传入 diff 和 initState 即可获取最后结果。不要写这么复杂。 |
|
||
setPast((past) => [ | ||
{ | ||
appForm, | ||
diff, | ||
title: title || formatTime2YMDHMS(new Date()), | ||
isSaved | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里,是不是得,始终保留第一条
No description provided.