diff --git a/docs/widget/src/components/CommentItem.js b/docs/widget/src/components/CommentItem.js index 571be54..9fe0b57 100644 --- a/docs/widget/src/components/CommentItem.js +++ b/docs/widget/src/components/CommentItem.js @@ -303,6 +303,7 @@ export class CommentItem extends Component { onCancel: () => this.handleCancelReply(), onClearError: () => this.handleClearReplyError(), placeholder: this.props.replyPlaceholder, + t: this.t }); this.replyEditor.render(); this.replyEditor.focus(); diff --git a/docs/widget/src/core/store.js b/docs/widget/src/core/store.js index e200a76..391fb59 100644 --- a/docs/widget/src/core/store.js +++ b/docs/widget/src/core/store.js @@ -133,8 +133,12 @@ export function createCommentStore(config, fetchComments, submitComment, likeCom }); // 监听用户信息变化,自动保存到 localStorage - store.subscribe((state) => { - if (state.form.name || state.form.email || state.form.url) { + store.subscribe((state, prevState) => { + if ( + state.form.name !== prevState.form.name || + state.form.email !== prevState.form.email || + state.form.url !== prevState.form.url + ) { saveUserInfo(state.form.name, state.form.email, state.form.url); } });