diff --git a/client/src/components/CommentApp/state/comments.ts b/client/src/components/CommentApp/state/comments.ts index f1fa59fcc6..eb31ccc369 100644 --- a/client/src/components/CommentApp/state/comments.ts +++ b/client/src/components/CommentApp/state/comments.ts @@ -1,7 +1,6 @@ import produce, { enableMapSet, enableES5 } from 'immer'; import type { Annotation } from '../utils/annotation'; import * as actions from '../actions/comments'; -import { update } from './utils'; enableES5(); enableMapSet(); @@ -225,7 +224,7 @@ export const reducer = produce( if (action.update.newText && action.update.newText.length === 0) { break; } - update(comment, action.update); + Object.assign(comment, action.update); } break; } @@ -280,7 +279,7 @@ export const reducer = produce( if (action.update.newText && action.update.newText.length === 0) { break; } - update(reply, action.update); + Object.assign(reply, action.update); break; } case actions.DELETE_REPLY: { diff --git a/client/src/components/CommentApp/state/settings.ts b/client/src/components/CommentApp/state/settings.ts index a6a47d7286..c5aea645ca 100644 --- a/client/src/components/CommentApp/state/settings.ts +++ b/client/src/components/CommentApp/state/settings.ts @@ -1,7 +1,6 @@ import produce from 'immer'; import * as actions from '../actions/settings'; import type { Author } from './comments'; -import { update } from './utils'; export interface SettingsState { user: Author | null; @@ -20,7 +19,7 @@ export const reducer = produce( (draft: SettingsState, action: actions.Action) => { switch (action.type) { case actions.UPDATE_GLOBAL_SETTINGS: - update(draft, action.update); + Object.assign(draft, action.update); break; default: break; diff --git a/client/src/components/CommentApp/state/utils.ts b/client/src/components/CommentApp/state/utils.ts deleted file mode 100644 index 437f3a1e5b..0000000000 --- a/client/src/components/CommentApp/state/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function update(base: T, updatePartial: Partial): T { - return Object.assign(base, updatePartial); -}