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: pending for submit & modify submit is not correctly displayed #118

Closed
wants to merge 1 commit into from

Conversation

Enter-tainer
Copy link
Member

mgt, [2024/9/29 23:09]
这里期望的事件发生顺序是这样的:

  1. 提交网络请求
  2. 将尚未提交的评论放进cache里面
  3. 重新渲染评论(为了显示刚刚放进去的那个)
  4. 等待网络请求返回
  5. 重新渲染评论

mgt, [2024/9/29 23:09]
之前这里用了两个race执行的promise,分别是
1 -> 2 -> 4 -> 5 和 3

@@ -243,7 +243,7 @@ export const submitComment = async ({
pending: true,
});
}

await openCommentsPanel();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不太好吧...在这种网络请求的函数做这种更改UI的调用会不会有点过耦合了

@@ -290,6 +290,7 @@ export const _modifyComment = async ({
);
}

await openCommentsPanel();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也是

@shaokeyibb
Copy link
Member

mgt/fix-race...hikarilan/refactor-fix-race

改了下,这样我觉得可能耦合度能低一点?

@Enter-tainer
Copy link
Member Author

ok 用你的分支吧

@shaokeyibb shaokeyibb deleted the mgt/fix-race branch October 5, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants