Skip to content
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions src/ui/VoiceMessageInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo, useState } from 'react';
import React, { useMemo, useState } from 'react';
import './index.scss';

import PlaybackTime from '../PlaybackTime';
Expand Down Expand Up @@ -63,13 +63,13 @@ export const VoiceMessageInput = ({
setLastClickTime(currentTime);
}
};
const handleOnControlClick = useCallback(() => {
const handleOnControlClick = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 useCallback을 없내는것도 방법이지만 dependencies에 lastClickTime, onControlClick, setLastClickTime을 추가하는것도 방법이 될 수 있을것 같습니다. 기존에도 아마 lastClickTime이 바뀌었을때에도 오동작을 하고 있었을것같네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

추후 Generelize해서 논의하는 걸로 결정되었습니다.

const currentTime = Date.now();
if (currentTime - lastClickTime > VOICE_RECORDER_CLICK_BUFFER_TIME) {
onControlClick?.(currentType);
setLastClickTime(currentTime);
}
}, [currentType]);
};
const handleOnSubmitClick = () => {
const currentTime = Date.now();
if (currentTime - lastClickTime > VOICE_RECORDER_CLICK_BUFFER_TIME) {
Expand Down